close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Displaying validated entries and/or recordset values BUT in a dynamic drop-down menu?

Thread began 12/04/2018 12:04 pm by Nathon Jones Web Design | Last modified 12/05/2018 1:29 pm by Nathon Jones Web Design | 624 views | 3 replies

Nathon Jones Web Design

Displaying validated entries and/or recordset values BUT in a dynamic drop-down menu?

When adding the WA Server Validations to any form, it quickly becomes apparent that when you submit the form, and validation fails, all of your form values are wiped and the user has to start the entire form again. I'm not sure why that is, but it's the current state of play.

So, you have to manually add the ValidatedField data as the default value for every field in your form, like so:

<input type="text" class="form-control" name="FirstName" id="FirstName" placeholder="First name" maxlength="30" value="<?php echo(ValidatedField("healthscreeningform_984","FirstName")) ?>" required>



But what if your form is populated by data from a recordset? Well, you have to double up the default value to include the ValidatedField data AND the Recordset data, like so:

<input type="text" class="form-control" name="FirstName" id="FirstName" placeholder="First name" maxlength="30" value="<?php echo(isset($_GET['v'])?ValidatedField("healthscreeningform_984","FirstName"):$rsEDITFORM->getColumnVal("SMCformFIRST")) ?>" required>



This is incredbily time consuming to configure, but it's working.

My problem is how to handle dynamic drop-down menus? At the moment I have the option values within a repeat region, like so...

<?php
while(!$rsCOUNTRIES->atEnd()) { //dyn select
?>
<option value="<?php echo($rsCOUNTRIES->getColumnVal("SMCcountryID")); ?>"<?php if (!(strcmp($rsCOUNTRIES->getColumnVal("SMCcountryID"), (ValidatedField("healthscreeningform_984","Country"))))) {echo "selected=\"selected\"";} ?>><?php echo($rsCOUNTRIES->getColumnVal("SMCcountryNAME")); ?></option>
<?php
$rsCOUNTRIES->moveNext();
} //dyn select
$rsCOUNTRIES->moveFirst();
?>



Two things this isn't doing. It's not displaying the Country from the Recordset ($rsEDITFORM), and it's also not remembering the ValidatedField data so the Country menu is wiped blank every time validation fails.

One thing that might be complicating this is that I have a sub-dependent State field which changes depending on what the user selects from the Country drop-down.

What is wrong with my code that it's not remembering the Country selection by the user, and how do I, like my other fields, also incorporate the Recordset country and region data?

This can be viewed at:
www.sportsmedicalcertificates.com/health-screening-form.php?tab1=1

Thank you
NJ

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