close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Form Validation on Update Pages

Thread began 6/26/2012 5:07 pm by jason363662 | Last modified 6/27/2012 10:39 am by Jason Byrnes | 758 views | 1 replies |

jason363662

Form Validation on Update Pages

I have form validation applied to a page that inserts a new record into the database and I have set it up so that if anything fails validation the information entered in the form persists in the fields through the validation - did this by following WA instructions to use the WA Validated Entries as the init val's in the for fields.

This works great when using a form to insert into the database, but I don't understand how to get the same effect with the form is instead updating the database. Now the init val's of the fields are set according to the recordset.

If I validate the entries and a validation fails all of the modified fields revert back to the recordset values.

Strategy for validating update forms? Thanks!

Sign in to reply to this post

Jason ByrnesWebAssist

in the server validation behavior, set the failed redirect to the form page and pass a URL variable:
update.php?valid=false


you can create a ternary expression to use the validated entries value if the URL variable valid is equal to false, or use the recordset value if not, for example:

php:
<?php echo(((isset($_GET['valid']) && $_GET['valid'] = "false"))?ValidatedField("update","firstName"):$row_recordsetName['FirstName']) ?>
Sign in to reply to this post

Cologne

Hey Jason,

can I perhaps use this, too?

<?php echo (isset($row_memberProfile['postcode'])?$row_memberProfile['postcode']:(ValidatedField("edit_390","postcode"))); ?>



why cant I use it the other way?

<?php echo (isset((ValidatedField("edit_390","postcode"))) ? (ValidatedField("edit_390","postcode")) : $row_memberProfile['postcode']); ?>



I need to delete some () but then I got that error

<?php echo (isset(ValidatedField("edit_390","postcode")) ? (ValidatedField("edit_390","postcode")) : $row_memberProfile['postcode']); ?>



Fatal error: Can't use function return value in write context in



cheers,
Denis

Sign in to reply to this post

Jason ByrnesWebAssist

You should use the URL variable isset, not the recordset or validated entries, it wont work that way

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