Edit form submit
1635
public function editTransversalSubmit(array &$form, FormStateInterface $form_state)
    {
        if (!$this->manager->getSiteContext()->isTemporary()) {

            // @todo Generate a better token (random).
            $token  = drupal_get_token();
            $layout = $this->manager->getSiteContext()->getCurrentLayout();
            $this->manager->getSiteContext()->setToken($token);

            // Saving the layout will force it be saved in the temporary storage.
            $this->manager->getSiteContext()->getStorage()->save($layout);

            $form_state->setRedirect(
                current_path(),
                ['query' => [ContextManager::PARAM_SITE_TOKEN => $token] + drupal_get_query_parameters()]
            );
        }
    }
847249
protected function submitEditField()
    {
        if ($this->isPosted('delete')) {
            $this->deleteField();
        } else if ($this->isPosted('save') && $this->validateEditField()) {
            if (isset($this->data_field['field_id'])) {
                $this->updateField();
            } else {
                $this->addField();
            }
        }
    }
988653
def submit(self):
        
        elm_name = '%s_submit' % self.get_attribute('id')
        try:
            self.click(elm_name)
        except NoSuchElementException:
            super(Form, self).submit()
538395
def build_edit_form(title, id, cols, return_page):
    
    txt = '<H3>' + title + '<H3>'
    txt += '<form action="' + return_page + '" method="POST">\n' # return_page = /agents
    txt += '  updating id:' + str(id) + '\n<BR>'
    txt += '  <input type="hidden" name="rec_id" readonly value="' + str(id) + '"> '
    txt += '  <TABLE width=80% valign=top border=1>'
    
    for col_num, col in enumerate(cols):
        txt += '  <TR>\n'
        txt += '    <TD><div id="form_label">' + col + '</div></TD>\n'
        txt += '    <TD><div id="form_input"><input type="text" name="col_' + str(col_num) + '"></div></TD>\n'
        txt += '  </TR>\n'
    txt += '  <TR><TD></TD>\n'
    txt += '  <TD>\n'
    txt += '    <input type="submit" name="update-form" value="Save Changes">\n'
    txt += '    <input type="submit" name="delete-form" value="Delete">\n'
    txt += '    <input type="submit" name="add-form" value="Add">\n'
    txt += '  </TD></TR></TABLE>'
    txt += '</form>\n'
    return txt
1293382
def edit_form(self, obj):
        """"""
        form = super(OAISetModelView, self).edit_form(obj)
        del form.spec
        return form
1126483
def submit_tag(text = "Save changes", options = {})
      options = options.stringify_keys

      content_tag :button, text, { "type" => "submit", "name" => "commit" }.update(options)
    end
1075247
public function editAction()
    {
        if ($form = $this->processForm()) {
            if ($this->useTabbedForms && method_exists($this, 'getSubject')) {
                $data = $this->getModel()->loadFirst();
                $subject = $this->getSubject($data);
                $this->setPageTitle(sprintf($this->_('Edit %s %s'), $this->getTopic(1), $subject));
            } else {
                $this->setPageTitle(sprintf($this->_('Edit %s'), $this->getTopic(1)));
            }
            $this->html[] = $form;
        }
    }
1009468
def edit(self):
        
        data = self.get_selected_item()
        if data.get('author') != self.reddit.user.name:
            self.term.flash()
            return

        if data['type'] == 'Submission':
            content = data['text']
            info = docs.SUBMISSION_EDIT_FILE.format(
                content=content, id=data['object'].id)
        elif data['type'] == 'Comment':
            content = data['body']
            info = docs.COMMENT_EDIT_FILE.format(
                content=content, id=data['object'].id)
        else:
            self.term.flash()
            return

        with self.term.open_editor(info) as text:
            if not text or text == content:
                self.term.show_notification('Canceled')
                return

            with self.term.loader('Editing', delay=0):
                data['object'].edit(text)
                time.sleep(2.0)

            if self.term.loader.exception is None:
                self.reload_page()
            else:
                raise TemporaryFileError()
447483
def edit(self, request, id):
        """"""
        try:
            object = self.model.objects.get(id=id)
        except self.model.DoesNotExist:
            return self._render(
                request = request,
                template = '404',
                context = {
                    'error': 'The %s could not be found.' % self.model.__name__.lower()
                },
                status = 404,
                prefix_template_path = False
            )

        form = (self.form or generate_form(self.model))(instance=object)

        # Add "_method" field to override request method to PUT
        form.fields['_method'] = CharField(required=True, initial='PUT', widget=HiddenInput)

        return self._render(
            request = request,
            template = 'edit',
            context = {
                cc2us(self.model.__name__): object,
                'form': form
            },
            status = 200
        )
15447
function toggleEdit() {
    document.body.classList.toggle('form-rendered', editing)
    if (!editing) {
      $('.build-wrap').formBuilder('setData', $('.render-wrap').formRender('userData'))
    } else {
      const formRenderData = $('.build-wrap').formBuilder('getData', dataType)
      $('.render-wrap').formRender({
        formData: formRenderData,
        templates: templates,
        dataType,
      })
      window.sessionStorage.setItem('formData', formRenderData)
    }
    return (editing = !editing)
  }
64847
def submit_form_action(step, url):
    
    form = world.browser.find_element_by_xpath(str('//form[@action="%s"]' %
                                                   url))
    form.submit()
360801
public function submitButton()
    {
        if (self::MODE_VIEW === $this->mode) {
            return '';
        }

        if (!$this->options['enableSubmit']) {
            return '';
        }

        if (self::MODE_EDIT === $this->mode) {
            $text = trans('admin.save');
        } else {
            $text = trans('admin.submit');
        }

        return <<<EOT
<div class="btn-group pull-right">
    <button type="submit" class="btn btn-info pull-right" data-loading-text="<i class='fa fa-spinner fa-spin '></i> $text">$text</button>
</div>
EOT;
    }
123387
function(){
      var self = this; // stored this
      // Handle submit event
      $( this.form ).submit( function( e ) {
        // fields to be controlled transferred to global variable
        FIELDS = this.querySelectorAll('[data-validetta]');
        return self.init( e );
      });
      // real-time option control
      if( this.options.realTime === true ) {
        // handle change event for form elements (without checkbox)
        $( this.form ).find('[data-validetta]').not('[type=checkbox]').on( 'change', function( e ) {
          // field to be controlled transferred to global variable
          FIELDS = $( this );
          return self.init( e );
        });
        // handle click event for checkboxes
        $( this.form ).find('[data-validetta][type=checkbox]').on( 'click', function( e ) {
          // fields to be controlled transferred to global variable
          FIELDS = self.form.querySelectorAll('[data-validetta][type=checkbox][name="'+ this.name +'"]');
          return self.init( e );
        });
      }
      // handle <form> reset button to clear error messages
      $( this.form ).on( 'reset', function() {
        $( self.form.querySelectorAll( '.'+ self.options.errorClass +', .'+ self.options.validClass ) )
          .removeClass( self.options.errorClass +' '+ self.options.validClass );
        return self.reset();
      });
    }
905235
function() {
			var editor = this,
				element = editor.element,
				form = new CKEDITOR.dom.element( element.$.form );

			// If are replacing a textarea, we must
			if ( element.is( 'textarea' ) ) {
				if ( form ) {
					form.on( 'submit', onSubmit );

					// Check if there is no element/elements input with name == "submit".
					// If they exists they will overwrite form submit function (form.$.submit).
					// If form.$.submit is overwritten we can not do anything with it.
					if ( isFunction( form.$.submit ) ) {
						// Setup the submit function because it doesn't fire the
						// "submit" event.
						form.$.submit = CKEDITOR.tools.override( form.$.submit, function( originalSubmit ) {
							return function() {
								onSubmit();

								// For IE, the DOM submit function is not a
								// function, so we need third check.
								if ( originalSubmit.apply )
									originalSubmit.apply( this );
								else
									originalSubmit();
							};
						} );
					}

					// Remove 'submit' events registered on form element before destroying.(#3988)
					editor.on( 'destroy', function() {
						form.removeListener( 'submit', onSubmit );
					} );
				}
			}

			function onSubmit( evt ) {
				editor.updateElement();

				// #8031 If textarea had required attribute and editor is empty fire 'required' event and if
				// it was cancelled, prevent submitting the form.
				if ( editor._.required && !element.getValue() && editor.fire( 'required' ) === false ) {
					// When user press save button event (evt) is undefined (see save plugin).
					// This method works because it throws error so originalSubmit won't be called.
					// Also this error won't be shown because it will be caught in save plugin.
					evt.data.preventDefault();
				}
			}

			function isFunction( f ) {
				// For IE8 typeof fun == object so we cannot use it.
				return !!( f && f.call && f.apply );
			}
		}
747737
function submit(form_id) {
        var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
        var method = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'POST';
        var headers = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : { 'X-Requested-With': 'XMLHttpRequest' };

        this._checkInit(form_id);
        var request = new XMLHttpRequest();
        if (url === null) {
            if (document.forms[form_id].hasAttribute('action')) {
                url = document.forms[form_id].getAttribute('action');
            } else {
                //throw new Error('Form.submit() is missing 2nd URL argument');
                url = '';
            }
        }
        request.open(method, url);
        var p = new Promise(function (success, fail) {
            request.onload = function () {
                if (request.status === 200) {
                    success(request.responseText);
                } else {
                    fail(request);
                }
            };
        });
        for (var header in headers) {
            request.setRequestHeader(header, headers[header]);
        }
        this._collection[form_id].set('categories', [2, 3]);
        request.send(this.getFormDataObject(form_id));
        return p;
    }
76376
function($form) {
        var $form = $form, _id = null;
        if ( typeof($form) == 'undefined' ) {
            if ( typeof(this.target) != 'undefined' ) {
                _id = this.target.getAttribute('id');
            } else {
                _id = this.getAttribute('id');
            }

            $form = instance.$forms[_id]
        } else if ( typeof($form) == 'string' ) {
            _id = $form;
            _id = _id.replace(/\#/, '');

            if ( typeof(instance.$forms[_id]) == 'undefined') {
                throw new Error('[ FormValidator::resetErrorsDisplay([formId]) ] `'+$form+'` not found')
            }

            $form = instance.$forms[_id]
        }

        if ($form.defaultFields) {

            var elId        = null
                , $element  = null
                , type      = null;

            for (var f in $form.defaultFields) {

                $element    = document.getElementById(f)
                type        = $element.tagName.toLowerCase();

                if (type == 'input') {
                    $element.value = $form.defaultFields[f];
                } else if ( type == 'select' ) {
                    $element.options[ $form.defaultFields[f] ].selected = true;
                    $element.setAttribute('data-value',  $element.options[ $form.defaultFields[f] ].value);
                }
            }
        }

        return $form
    }
455311
public function editAction()
    {
        $this->view->disable();
        $id = $this->request->getPost("hidden_id");
        $banner = Banner::findFirst($id);
        $msg ="";
        if($this->request->hasFiles() !== false) {
            if(! empty($_FILE['file']['tmp_name'])) {
                if (!empty($banner->file)) {
                    unlink("upload/banner/" . $banner->file);
                }
            }
            $uploader = new \Uploader\Uploader([
                'directory' =>  "upload/banner/",
                'mimes'     =>  [
                    'image/gif',
                    'image/jpeg',
                    'image/png',
                ],
                'extensions'     =>  [
                    'gif',
                    'jpeg',
                    'jpg',
                    'png',
                ],

                'sanitize' => true,  // escape file & translate to latin
                'hash'     => 'md5'
            ]);

            if($uploader->isValid() === true) {

                $uploader->move();

                $file   = $uploader->getInfo();
                $alert  = "sukses";
                $msg    .= $file[0]['filename'];
                $_file  = $file[0]['filename'];
            }
            else {
                $alert  = "error";
                $msg    .= $uploader->getErrors();
                $_file  = "";
            }
        }

        if(isset($_file)){
            $banner->file           = $_file;
        }

        $banner->order          = $this->request->getPost("order");
        $banner->publish        = $this->request->getPost("publish");
        $banner->description    = $this->request->getPost("description");
        $banner->description1   = $this->request->getPost("description1");
        $banner->link           = $this->request->getPost("link");
        $banner->update_user    = $this->auth->getIdentity()['id'];
        if (!$banner->save()) {
            $alert  = "error";
            foreach ($banner->getMessages() as $message) {
                $msg .= $message." ";
            }
        }else{
            $alert  = "sukses";
            $msg    .= "Banner was edit successfully";
        }
        $response = new \Phalcon\Http\Response();
        $response->setContentType('application/json', 'UTF-8');
        $response->setJsonContent(array('_id' => $id,'alert' => $alert, 'msg' => $msg ));
        return $response->send();
    }