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

Validation Show If - wiping the form field content?

Thread began 1/08/2015 10:23 am by Nathon Jones Web Design | Last modified 1/08/2015 11:48 am by Jason Byrnes | 871 views | 5 replies |

Nathon Jones Web Design

Validation Show If - wiping the form field content?

I've got Show If Validation on an input field and when it fails the validation it wipes the data entered in the field.

If you try this page:
http://www.doorsets.org.uk/apollodoors/contact-Apollo-Doors.php

..and enter "Joe Plumber 12345" in the name it will fail because I have set it to not allow numbers, But it wipes the Joe Plumber 12345 text and I want that text to remain to allow the user to correct the error.

Hope you can help. Thank you.
NJ

Sign in to reply to this post

Jason ByrnesWebAssist

Use the form binding then instead of the validated entries binding group.

the validated entries binding group is set up to form values that pass validation, but not save entries that fail.

if you want to keep entries that fail, use the form binding group for the initial values of the form elements.

Sign in to reply to this post

Nathon Jones Web Design

Form binding group? Where would I find that?
Thank you Jason.
NJ

EDIT: Do you mean adding this to each form field:
value="<?php echo((isset($_POST["FormInputName"]))?$_POST["FormInputName"]:"") ?>"

When I do that, it doesn't retain it, it replaces it with the placeholder text.

Sign in to reply to this post

Jason ByrnesWebAssist

oh, right, the page refreshes when validation fails, so the post empty, sorry about that.

you could save the form to session variables, and use the sessions instead. a quick way to do that is to add the following code at line 1:

<?php
@session_start();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
foreach($_POST as $key => $value) {
$_SESSION['savedform'][$key] = $value;
}
}
?>



this will create a session away named saved form with an index for each form element that you can use in the value for the form instead of the post:

value="<?php echo((isset($_SESSION['savedform']['FormInputName']))?$_SESSION['savedform']['FormInputName']:"") ?>"
Sign in to reply to this post

Nathon Jones Web Design

I'm not sure it refreshes, it just posts to the same page. I've implemented your suggestion though and it works great, thank you.

How would you advise I handle a successful form submission? I'd rather the form just disappeared and was replaced with a "thank you" message of some kind. Is that possible within the same page?

Thank you.
NJ

Sign in to reply to this post

Jason ByrnesWebAssist

in whatever behavior you are using to process the form:

Universal Email if it sends an email, Insert record if it saves the data to a database etc...

you can specify a page to go to after it completes. set this to go to a thank you page.

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