close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Conditional Validation: Both cannot be blank

Thread began 3/03/2010 2:25 pm by yogastudents362523 | Last modified 3/03/2010 4:52 pm by Jimmy Wu | 710 views | 2 replies |

yogastudents362523

Conditional Validation: Both cannot be blank

I want Validation Toolkit to insist that I receive either a cell phone number or a land number from my form. One of ['cellphone'] OR ['contactphone'] is required, but both can be provided if desired.

Suppose my error message is "NO". What coding must surround "NO" so Validation Toolkit does what I want and shows "NO" if both phone number fields on my form are left blank?

Please keep this very very simple! I am learning fast ... but I am obviously still a newbie. I've tried experimenting with:
!isset($_POST['contactphone']?!$_POST['cellphone']:"NO" but it's not working out. Either I have that wrong, or I am inserting it in the wrong place.

Thanks.


Thanks.

Sign in to reply to this post

yogastudents362523

Originally Said By: yogastudents362523
  I want Validation Toolkit to insist that I receive either a cell phone number or a land number from my form. One of ['cellphone'] OR ['contactphone'] is required, but both can be provided if desired.

Suppose my error message is "NO". What coding must surround "NO" so Validation Toolkit does what I want and shows "NO" if both phone number fields on my form are left blank?

Please keep this very very simple! I am learning fast ... but I am obviously still a newbie. I've tried experimenting with:
!isset($_POST['contactphone']?!$_POST['cellphone']:"NO" but it's not working out. Either I have that wrong, or I am inserting it in the wrong place.

Thanks.


Thanks.  



OK. I think I solved my own problem.
I will create a third, hidden field.
I will then arrange for it to be filled, conditinally, with either one or the other of my two phone fields.

I will then validate that third field. It will be required, and may not be blank. I believe that will work.
Thanks.

Sign in to reply to this post

Jimmy Wu

That sounds like it will work for this purpose. Make sure to put the code that populates the hidden field before the code that validates the hidden field.

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...