close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Form Field Validation non-active if fields are hidden

Thread began 4/16/2014 10:13 am by s.joiner74419001 | Last modified 4/16/2014 12:52 pm by Jason Byrnes | 596 views | 6 replies |

s.joiner74419001

Form Field Validation non-active if fields are hidden

I have created a custom form which is part of an application process and in this form I have a menu field with two options which are: 'SIngle payment' or 'Split payment'. If split payment is selected then it reveals other form fields. I have done this with this small piece of Javascript:

<script>
$('#payment_option').on('change',function(){
if( $(this).val()==="Split"){
$("#split-payment").show()
}
else{
$("#split-payment").hide()
}
});
</script>

if the 'Single Payment' option is selected then the additional form fields are hidden.
Consequently is there a way I can have validation for these fields but only effective when the form fields are visible

I hope this makes sense!

Sign in to reply to this post

Jason ByrnesWebAssist

use server validation for those fields, you will then need to edit the server validation for those fields and add an if statement:

if(isset($_POST['menuFieldName']) && $_POST['menuFieldName'] == "Split") {
<validation for the other fileds>
}

Sign in to reply to this post

s.joiner74419001

If I use the CSS form builder to create the form before adding my "show/hide javascript function". does that mean I should have the required option ticked in the 'Edit Field Values' window?

Sign in to reply to this post

Jason ByrnesWebAssist

yes, that is correct.

if you need help setting this up, we can help in a premiere support appointment:
http://www.webassist.com/premier_request.php

Sign in to reply to this post

s.joiner74419001

Thanks Jason, ill see how I get on. If I fail then I will get back to you!

Probably the later!!

Sign in to reply to this post

s.joiner74419001

are you able to explain in more detail where I add the if statement? I am clicking on the WA Server Validations behaviour in the Server Behaviours Window. So do add it here or do I have to adjust the code manually?

Sign in to reply to this post

Jason ByrnesWebAssist

you have to adjust the code manually.

in the code for the server validation, locate the lines that validate the conditional items, and add an if statement around them.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...