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

Show if

Thread began 12/01/2012 6:54 am by thehalpeen319342 | Last modified 12/03/2012 1:51 pm by thehalpeen319342 | 713 views | 4 replies |

thehalpeen319342

Show if

Dear Jason, I’m back at the registration page – just when I thought here were sorted. I’m adding some extra server-side validation – in particular some validation to work on the email field so as to avoid duplications in the database table – so I’m using ‘unique database value’ server validation.

Note: I’ve turned off Javascript in Firefox.

PROBLEM 1
Firstly, in my CSS Form Builder ‘Registration form’, I’ve added an extra ‘show if’ validation for the ‘unique database value’ and that works. I have noticed in the code that it did not add any ‘span or an id’ like in the other show if message for the same filed that CSS Form Builder added – so I need to have a class and an id. I probably need the class for the colour, but what is, and how is, the ‘id’ generated – see code below:
Email Validation code:
<?php
if (ValidatedField('register','register')) {
if ((strpos((",".ValidatedField("register","register").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?>
<span class="serverInvalidState" id="Email_Address_ServerError">Please enter email address.</span>
<?php //WAFV_Conditional register.php register(1:)
}
}
}?>
<?php
if (ValidatedField('register','register')) {
if ((strpos((",".ValidatedField("register","register").","), "," . "13" . ",") !== false || "13" == "")) {
if (!(false)) {
?>
Email address already registered!
<?php //WAFV_Conditional register_test.php register(13:)
}
}


In addition, apart from the ‘already registered’ message appearing in black, it is not properly aligned like the ‘please enter an email’ message – screenshots attached.

PROBLEM 2
I was going to add another validation for invalid email entries and have a show if saying (not a valid email) - is this overkill on the validation. Anyway, as things stand, with two validations on this email field, if the field is left bank and I hit submit, all two ‘show if’ messages appear (see attached screenshots), so I imagine if I had another ‘show if’ message, all three would appear. How can this be avoided so that if the field is left blank only the ‘show if’ - please enter an email – appears?

PROBLEM 3
I watched your video ‘Add server validation to your web forms’. I have one question:
Why is the instructor hopping over to the confirm.php page to do the validations. Surely, the validation should be done on the checkout.php page – because that is where the information is entered? The instructor talks about the confirm.php page being the action page and then selects the confirm.php page when she is setting up the show if message, even though the message is on the checkout.php page – I don’t get it.

Attached Files
Show if message.pdf
register.zip
Sign in to reply to this post

Jason ByrnesWebAssist

1) the class for the span tag should be:
serverInvalidState

The ID is not important as long as it is unique.

2) When adding the email address validation, you can select the option to Allow Blank Entry. This way the invalid email address error will not display if the email address is left blank.

by also adding the required validation, it will force the email address to be a required field that cannot be left blank, regardless of the Allow Blank Entry setting in the Email Address validation

3) All form processing (this includes server validation) must occur on the forms action page. In the tutorial, they are validating the checkout form on the checkout page. The action of the checkout form is to post to the confirm page, all of the processing of the checkout form must occur on the confirm page in that instance.

Sign in to reply to this post

thehalpeen319342

Interesting. I haven't dealt with a form that posts to another form (novice)

So if your just posting your form say 'registration.php' details to the database, do you just do the validation on register.php?

Sign in to reply to this post

Jason ByrnesWebAssist

  So if your just posting your form say 'registration.php' details to the database, do you just do the validation on register.php?  



yes, that is correct.

Sign in to reply to this post

thehalpeen319342

Thanks Jason.

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