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

form fields not validating properly

Thread began 2/19/2010 1:01 pm by Brendafrank306873 | Last modified 2/21/2010 9:52 am by neilo | 1234 views | 9 replies |

Brendafrank306873

form fields not validating properly

Using the Contact Form solution Pack and Dreamweaver, I made a form here: contactus.php The email notification works. The security works. Some of the required fields, like name, work. However, when you submit without the name, the form highlights ALL of the fields with error messages.

If you omit some of the other required fields, like phone number (day) or the checkboxes, the form submits and sends the email.

I don't know PHP. I have read all the supporting materials and the relevant forum messages and I need help making this behave properly. I have attached the php page. Thank you.

Attached Files
form.zip
Sign in to reply to this post

neilo

Hi Brenda,

You have added

<input name="addblock" type="text" id="addblock" style="display:none" value="" >

to each of your input fields, and each one has the same ID. There would need to be a seperate 'WA Sever Validation' server behavior for each field, in the php code that is placed before the DOCTYPE declaration, with a separate ID to correspond with each of those lines.

I think you could just remove these lines from all but the 'name' input field and let the spry validation widgets take care of the rest.

Sign in to reply to this post

Brendafrank306873

No Change in Validation Misbehavior

Hi Neilo,

I did as you suggested and deleted the <input name="addblock" type="text" id="addblock" style="display:none" value="" >
from all but the name fields. The form validation is still wacky. No change.

If I fail to fill in the name, the form displays ALL the error messages.

If I leave out other required fields like address, the form submits and thanks me. Same with failure to check any boxes.

If I fail to fill in the comment area, the form behaves correctly by telling me to fill out the comment area, but NOT displaying the error messages in the other fields.

Still need to figure this out.

Sign in to reply to this post

neilo

Hi Brenda,

That's odd. Is it OK to do test 'sends' using the form, or does it go to someone who wouldn't appreciate getting test emails?

Sign in to reply to this post

neilo

Hi Brenda,

For many of the fields you have the same onBlur server error ID (nameServerError), so they will all display similarly if the 'name' field doesn't validate.

I think the best bet would be to keep the original contactus.php fields and sections of code (both above the 'DOCTYPE' line and in the javascript widgets at the end) and clear the rest of the fields of any spry or error code - so it is just the input (type name id etc) left.

Make sure the form sends OK with just the name, email and comment fields requiring validation, then add the validations to your extra fields, either using the Server Validations from the WA Validation Toolkit (Server Behaviors > Click the 'Plus' Button > WA Validation Toolkit > Server Validations), or using the Dreamweaver Insert > Spry > Spry Validation X field.

Doing it this way will ensure that each field will be correctly identified for validationn.

Sign in to reply to this post

Brendafrank306873

Working on it

Hi Neilo,

Thanks for the help. Still having the validation problems. I have attached the revised file. I removed the php validation code from the optional fields: address2, eve phone, company and title. The required fields that I added still aren't acting as required fields: the checkboxes, the daytime phone, etc. I still have the validation message problems.

It's ok to test the form. The email comes to me. I've done it dozens of times. I think that I just don't understand the php and spry code enough to do this. I used the Contact Form program and Dreamweaver.

The form does submit, with the thank you page and the email is sent, the validation on the fields is the only problem.

Not there, yet.

Attached Files
form.zip
Sign in to reply to this post

neilo

Cheers for uploading the page. I will go over it tomorrow am and post back.

Sign in to reply to this post

neilo

Maybe?

Hi Brenda, - have been going over your page (using it as a learning tool) and think it's pretty much there now. Have been testing it here and haven't found any holes, but I now have form-code blindness and may have missed a testing permutation.

Could you give it a thorough testing please and post back if you find any problems?

I have zipped and attached the revised page.

Update: Fixed the 'Show If' server behaviour for multiple checkboxes.

Attached Files
contactus2.zip
Sign in to reply to this post

Brendafrank306873

Victory!

Hey Neilo,

You're my hero! Actually, I added a spry widget to the e-mail field so that it behaved like all the other required fields. The 3-checkbox group was supposed to be a required check one but wasn't. But, I really don't think that matters (unless the client says it does).

Now, it's behaving perfectly, just like it's supposed to. Thank you so much for your help.

Brenda

Sign in to reply to this post

neilo

Brilliant - glad you got it sorted.

I didn't know whether the 3 checkbox validation was for one, two or all, so I just set it to 'at least' 1.

Cheers

Sign in to reply to this post
loading

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