If the user already submitted the form and decided to return from the
        confirmation page, then re-populate the form
428845
def get_initial(self):
        '''
        
        '''
        initial = super(SendEmailView, self).get_initial()

        form_data = self.request.session.get(EMAIL_VALIDATION_STR, {}).get('form_data', {})
        if form_data:
            initial.update(form_data)
        return initial
1132212
def after_model_change(self, form, User, is_created):
        """"""
        if is_created and form.notification.data is True:
            send_reset_password_instructions(User)
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
    }
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();
      });
    }
1267423
function definition_after_data() {
        $mform   = $this->_form;
        $columns = $this->_customdata['columns'];

        foreach ($columns as $column) {
            if ($mform->elementExists($column)) {
                $mform->removeElement($column);
            }
        }

        if (!in_array('password', $columns)) {
            // password resetting makes sense only if password specified in csv file
            if ($mform->elementExists('uuforcepasswordchange')) {
                $mform->removeElement('uuforcepasswordchange');
            }
        }
    }
767770
private function resetStatus()
    {
        $this->debug->info('resetStatus');
        $this->status = \array_merge($this->status, array(
            'currentPageName'   => $this->persist->get('currentPage.name'),
            // 'keyVerified'    => false,   // don't reset
            // 'submitted'      => false,   // don't reset
            'completed'         => false,
            'error'             => false,
            'postMaxExceeded'   => false,
            'multipart'         => false,   // multipart form (file fields)?
            'additionalPages'   => array(),
            // 'invalidFields'      => array(),
            'idCounts'          => array(),
        ));
    }
681291
def user_return(self, frame, return_value):
        """"""
        pdb.Pdb.user_return(self, frame, return_value)
268078
public function doRestore($data, $form)
    {
        $record = $this->owner->getRecord();

        $message = RestoreAction::restore($record);

        $controller = $this->owner->popupController;
        $controller->getRequest()->addHeader('X-Pjax', 'Content');
        $controller->getEditForm()->sessionMessage($message['text'], $message['type'], ValidationResult::CAST_HTML);

        return $controller->redirect($controller->Link(), 'index');
    }
1118872
function get_data() {
        $mform =& $this->_form;

        if (!$this->is_cancelled() and $this->is_submitted() and $this->is_validated()) {
            $data = $mform->exportValues();
            unset($data['sesskey']); // we do not need to return sesskey
            unset($data['_qf__'.$this->_formname]);   // we do not need the submission marker too
            if (empty($data)) {
                return NULL;
            } else {
                return (object)$data;
            }
        } else {
            return NULL;
        }
    }
638377
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]
        }
        //reseting error display
        handleErrorsDisplay($form['target'], []);

        return $form
    }
918820
protected function _populate() {
		if ($this->closed() || !$this->_result->valid()) {
			return;
		}
		$data = $this->_result->current();
		$result = $this->_set($data, null, ['exists' => true, 'original' => true]);
		$this->_result->next();

		return $result;
	}
669599
def add
      return if !verify_logged_in

      resp = Caboose::StdClass.new

      if SavedProperty.exists?(:user_id => logged_in_user.id, :mls => params[:mls])
        resp.success = true
      else
        p = SavedProperty.new(
          :user_id  => logged_in_user.id,
          :mls => params[:mls]
        )
        if p.save
          resp.success = true
        else
          resp.error = "There was an error saving your property."
        end
      end
      render :json => resp
    end
216270
def post(self, *args, **kwargs):
        
        # Look for a wizard_prev_step element in the posted data which
        # contains a valid step name. If one was found, render the requested
        # form. (This makes stepping back a lot easier).
        wizard_prev_step = self.request.POST.get('wizard_prev_step', None)
        if wizard_prev_step and wizard_prev_step in self.get_form_list():
            self.storage.current_step = wizard_prev_step
            form = self.get_form(
                data=self.storage.get_step_data(self.steps.current),
                files=self.storage.get_step_files(self.steps.current))
            return self.render(form)

        # Check if form was refreshed
        management_form = ManagementForm(self.request.POST, prefix=self.prefix)
        if not management_form.is_valid():
            raise ValidationError(
                'ManagementForm data is missing or has been tampered.')

        form_current_step = management_form.cleaned_data['current_step']
        if (form_current_step != self.steps.current and
                self.storage.current_step is not None):
            # form refreshed, change current step
            self.storage.current_step = form_current_step

        # get the form for the current step
        form = self.get_form(data=self.request.POST, files=self.request.FILES)

        # and try to validate
        if form.is_valid():
            # if the form is valid, store the cleaned data and files.
            self.storage.set_step_data(self.steps.current, self.process_step(form))
            self.storage.set_step_files(self.steps.current, self.process_step_files(form))

            # check if the current step is the last step
            if self.steps.current == self.steps.last:
                # no more steps, render done view
                return self.render_done(form, **kwargs)
            else:
                # proceed to the next step
                return self.render_next_step(form)
        return self.render(form)
1139830
function() {
			/// <summary>
			/// Resets the controlled form.
			/// Resets input fields to their original value (requires form plugin), removes classes
			/// indicating invalid elements and hides error messages.
			/// </summary>

			if ( $.fn.resetForm )
				$( this.currentForm ).resetForm();
			this.submitted = {};
			this.prepareForm();
			this.hideErrors();
			this.elements().removeClass( this.settings.errorClass );
		}
1325697
function deferFormSubmit(evt, form, callback){
  var timeout = 500;
  // Fire listener and catch possible response (return false)
  var cbResponse = callback(evt);

  // If prevented within callback, bail
  if (('boolean' === typeof cbResponse && cbResponse === false) || evt.defaultPrevented || evt.returnValue === false) {
    if (evt.preventDefault) {
      evt.preventDefault();
    }
    evt.returnValue = false;
    return false;
  }
  // Defer and replay event
  else {
    if (evt.preventDefault) {
      evt.preventDefault();
    }
    evt.returnValue = false;
    if (typeof cbResponse !== 'undefined') {
      if (navigator && navigator.sendBeacon) {
        form.submit();
        return;
      }
      // promise
      cbResponse.then(() => {
        form.submit();
      }).catch(err => {
        // submit form anyway - to not let user hanging
        form.submit();
      });
    } else {
      setTimeout(function(){
        form.submit();
      }, timeout);
    }
  }

  return false;
}
377109
def render_done(self, form, **kwargs):
        
        final_form_list = []
        # walk through the form list and try to validate the data again.
        for form_key in self.get_form_list():
            form_obj = self.get_form(step=form_key,
                data=self.storage.get_step_data(form_key),
                files=self.storage.get_step_files(form_key))
            if not form_obj.is_valid():
                return self.render_revalidation_failure(form_key, form_obj, **kwargs)
            final_form_list.append(form_obj)

        # render the done view and reset the wizard before returning the
        # response. This is needed to prevent from rendering done with the
        # same data twice.
        done_response = self.done(final_form_list, **kwargs)
        self.storage.reset()
        return done_response
1096416
def save_form(self, request, form, change):
        """"""
        instance = super(PageAdmin, self).save_form(request, form, change)
        instance.template = form.cleaned_data['template']
        if not change:
            instance.author = request.user
        return instance