PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Pre Submission Validation & Disabling Submit Button

  1. kausar
    Member

    Hi

    My question is that I have a text box which will be filled with a number say 123456 and then another text box which will be filled by another number say 154689. What my requirement is that when i enter the value in second box , if its higher than 80% of the value in Txtbox1 , an error gets generated and the submit button gets disabled.

    Can this be done by using any hooks ?

    Also another request is that the form has a conditional logic set to show/hide the submit button, but i feel it would have been great to see an option of just "Disabled" too.

    I look fwd for an early reply.

    thanks!

    Posted 12 years ago on Tuesday October 18, 2011 | Permalink
  2. You can do whatever sort of validation you want using the gform_validation filter. It's documented here:

    http://www.gravityhelp.com/documentation/page/Gform_validation

    Posted 12 years ago on Tuesday October 18, 2011 | Permalink
  3. kausar
    Member

    Hi Chris

    Thanks for the quick reply. Well my question was different. What I need is something like this
    Using Javascript i would have done it like below
    textbox2 : OnChange="validateFunc();" and this validateFunc has code in it to give an error message and also disable or hide the submit button.
    How can i do it here ?
    I hope i make a sense.
    Thanks!

    Posted 12 years ago on Tuesday October 18, 2011 | Permalink
  4. You can add that JavaScript to the page with a form like any other page. Would that work in this situation? Sounds like you want to have it happen on the client side, before the form is actually submitted.

    Posted 12 years ago on Tuesday October 18, 2011 | Permalink
  5. kausar
    Member

    Hi Chris

    See the below form
    http://hidayahsoft.com/demo/?page_id=2
    I have created it using GF and i like the way it works.
    If you notice that I have two textboxes (number boxes) named as
    Estimated Market Value of Property ($)* and Requested Loan Amount ($)*
    I have a validation done on them, some 3 types of validations depending on the value of the element input_1 .

    I wish i could do something like conditional logic i have done on the bottom radio buttons. If you see if user chooses "NO", the HTML element comes up and the Submit button hides . I wish same thing happens for the textboxes i named above. Meaning when i type say 222222222 no in textbox 2 while i'm still typing i get error msg , PRESUBMISSION thing.

    Thanks!

    Posted 12 years ago on Wednesday October 19, 2011 | Permalink