logo
Tags down

shadow

Can I do multiple validations in a wizard type form?


By : Boxgrafik
Date : October 16 2020, 03:08 PM
I wish this help you I am building out a wizard-like form in react-native using the redux-form package but am not conditionally rendering each step like in the example. , I solved my issue by using the redux form getFormSyncErrors selector.
code :
import { 
  reduxForm,
  Field,
  getFormSyncErrors 
} from 'redux-form';
Component = connect(
  state => ({
    syncErrors: getFormSyncErrors('formName')(state)
  })
)(Component);
render(){
  const { syncErrors } = this.props;
  const fields = ['first_name', 'last_name', 'email'];
  const errorFields = syncErrors ? Object.keys(syncErrors) : [];
  const hasErrors = fields.some(el => errorFields.indexOf(el) >= 0);

  return(
    {...Fields}
    <ActionButton
      text='Continue'
      handleButtonPress={this.goToStep}
      disabled={this.props.pristine || hasErrors}
    />
  )
}


Share : facebook icon twitter icon

Writing custom validations using jquery form wizard


By : Sunny Sharma
Date : March 29 2020, 07:55 AM
will be helpful for those in need Here is an answer from the Jan Sundman, the author of jquery-form-wizard (he asked me to post it in his stead):
If I understand your question correctly, you would like to do the validation in the beforeSend method, before the request is sent to the server using the remoteAjax?
code :
remoteAjax: {
 "page1" : {
   url: "./validateWizard1",
   dataType: "json",
   beforeSubmit: function() {
     // This code is called before "page1" is turned.
     return false;
   },
   success: handleValidateSubmit
 }
}

Rails validations for form wizard, best way to update step


By : Ravi Mankar
Date : March 29 2020, 07:55 AM
To fix the issue you can do I have a form wizard that validates certain fields based on what the objects current step is. The problem I am having is that since the current_step is a part of the model, I cannot update the current_step without the validation failing. Let me show you what i mean. , You can do something as simple as:
code :
@user.update_attribute(:current_step, @user.next_step)
params[:user][:current_step] = @user.next_step
@user.update(params)

I'm trying to get form validations to work with an Angular Wizard


By : user2510601
Date : March 29 2020, 07:55 AM
should help you out It's definitely a scoping problem. I was able to get things to work by reaching into the scope of a child element (in the controller) and by defining the variables in the view (html) as being part of the $parent element. This means that all of the variables are set in HTML as
code :
ng-model="$parent.variableName";
$scope.$$childTail.variableName = 'something that you want to change the value to';

How to use multiple forms with a Form Wizard form in the same template (Django)


By : Mian Rizwan
Date : March 29 2020, 07:55 AM
it helps some times I'm using multiple forms in the same template and they all work until I add my Form Wizard, when it becomes that either the FormWizard - form works or the rest of the forms works but not both simultaniousely. , The line
code :
url(r'^label',ContactWizard.as_view([Form1, Form2, Form3])),  
url(r'^label(?P<one_labeling>\d+)/$', 'formwizard.views.one_labeling'),
url(r'^label(?P<postID>\d+)$',one_labeling), #<----- here

Redux Form: Conditional form validations with multiple submit buttons


By : Akshay Bhat
Date : March 29 2020, 07:55 AM
hop of those help? After a lot of headaches and head scratching, I've finally found the solution without making things look ugly. to a fellow developer for this solution. Original idea was to set a flag on click of the button and conditionally validate the fields. (PS: I'm using Field Level Validations). However, the issue was that the validations are being executed BEFORE the flag setting as the onClick handler wouldn't fire before all the validations are fixed and that logic is buried deep inside redux-forms (perks of unnecessarily overcomplicating simple things by using a library).
Here is the solution:
code :
handleSubmit() {
    const { bookingCreate, modalShow, navigateTo } = this.props;
    const { isDraftAction } = this.state; // my flag

    // create record!
    return bookingCreate(isDraftAction)
      .then(responsePayload => {
        ...
      })
      .catch(handleSubmissionError);
 }
    <Field
      name="date"
      component={DateFormField}
      validate={isDraftAction && [validateRequiredText]}
      fullWidth
      helpText="blablabla"
    />
    <Field
      name="title"
      component={TextFormField}
      normalizeOnBlur={normalizeTextOnBlur}
      validate={!isDraftAction && [validateRequiredText]}
      fullWidth
      helpText="blablabla"
    />
  const submit = handleSubmit(values => onSubmit()); // this is redux-form's submit handler which will in-turn call my own submit handler defined above. (That's where the library hides all the logic and makes developer helpless)

  <RaisedButton
    label={submitting && isDraft ? 'Saving Draft...' : 'Save Draft'}
    type="button"
    onClick={() => {
      this.props.dispatchAction({ draftAction: true }).then(() => {
        submit();
      });
    }}
    disabled={submitting}
    primary
  />
  <RaisedButton
    label={submitting && !isDraft ? 'Submitting Brief...' : 'Submit Brief'}
    type="button"
    onClick={() => {
      this.props.dispatchAction({ draftAction: false }).then(() => {
        submit();
      });
    }}
    disabled={submitting}
    primary
  />
     dispatchAction={({ draftAction }) =>
        new Promise(resolve => {
          this.setState({ isDraftAction: draftAction }, resolve);
        })
      }
shadow
Privacy Policy - Terms - Contact Us © soohba.com