You are viewing limited content. For full access, please sign in.

Question

Question

Not make email a required field when form is rejected

asked on April 25

I have an "email edit form" that requires an email if it is being submitted: However, if the form is rejected, we do not need an email as it is going back to the previous step.

I added this script "when reject button is click, ignore required fields" 

   $(document).ready(function() {
        $( ".action-btn.Reject" ).on('click', function() {
            $(" [required]").each(function() {
                $( this ).removeClass( 'required' );
                $( this ).removeAttr( 'required' );
            });
        });
    });

Now when we hit reject, I get this:

Any help is appreciated, thank you. 

0 0

Answer

APPROVED ANSWER
replied on April 25

I would personally avoid this by creating an "Approve/Reject" radio button field that will validate the email field as not required when "Reject" is selected. This way, the handling can be done without Javascript and is not related to the Submit button.

5 0

Replies

replied on April 25 Show version history

This is what Kevin is trying to recommend to you, which I find to be a very applicable path for cases like these.

req1.gif
req1.gif (4.87 MB)
2 0
replied on April 25

Depending on what your gateway rules are, you could Hide the email address field all together, but I would suggest moving the Approve/Reject above it as people will fill it in automatically and then select the Reject button, but the value won't drop from the field.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.