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

Validations stopped working

Thread began 8/08/2009 1:23 am by michellem310468 | Last modified 8/18/2009 7:17 pm by Jason Byrnes | 2090 views | 10 replies |

michellem310468

Validations stopped working

Can anyone tell me how to use WA to update a mysql column ONLY IF the form is is not empty?

Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

Validation toolkit can be used to accomplish this:
validation-toolkit/

You can use either Client Side or Server Side Validation, but server side is more secure since Client Side Validation uses javascript which can be disabled in the browser.

Sign in to reply to this post

michellem310468

Could you give an example? I couldn't find specific documentation on this.

Basically, and I have a multi-field form, including an image upload, that uses WA UPDATE. I just want to set it up so that if any of the non-required fields are left blank, existing data doesn't get overwritten with empty strings.

I'm getting tripped up somewhere.

Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

An update form would have a recordset that pulls the data that was in the database for that record and set the form fields so that they initial have the value form the record set.

If you want an example of this, run the DataAssist wizard and examine the update page that is created.

You want the form fields to contain the data from the recordset when the page is loaded. This way, all the original data is added back and any changed data is updated.

Sign in to reply to this post

michellem310468

Sorry, perhaps I wasn't clear. The only issue I am having is with the photo upload field on an "update profile" page that is part of a registration system. All other fields fill and update as they should. But the photo field is not required, so it may be left empty. If someone has already uploaded a file and does not want to upload a new one, the original filename in the database gets overwritten (empty) when the update form is submitted. My question is, how do I avoid this?

Right now, this is the code for the file upload field:
<input class="noformstyle" type="file" name="UserPhoto" id="UserPhoto" size="30" value="<?php echo $row_WAATKusers['UserPhoto'] ?> ">

Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

Ahhh, now I see the problem.

A file field cannot be assigned a value.

The basic idea is to create hidden form element, the initial value for the hidden element comes from the recordset. In the DFP Upload behavior, bind the default file option to the hidden form element. If no file is uploaded, it will use the default file value.


See the "How to apply Digital File Pro to DataAssist Insert and Update pages" tutorial on the How to section of the DFP Support page for more details:
digital-file-pro/

Sign in to reply to this post

michellem310468

I have followed the instructions in the file you linked to, but am still unable to get this to work. (Also, there is no "Server File Name" option).

Here's my code:

?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if($_SERVER["REQUEST_METHOD"] == "POST"){
WA_DFP_UploadFile("WA_UploadResult1", "UserPhoto", "".((isset($_POST["UserPhotoDefault"]))?$_POST["UserPhotoDefault"]:"") ."", "../../../dB/ScientistPhotos/", "[FileName]", "0", "[FileName]_[Increment]", "500", "false", "0", "0");
}
?>
....

<input type="hidden" name="UserPhoto" id="UserPhoto" value="<?php echo $row_WAATKusers['UserPhoto'] ?> ">
<input class="noformstyle" type="file" name="UserDefaultPhoto" id="UserDefaultPhoto" size="30" >


What am I missing?

Sign in to reply to this post

michellem310468

Apologies - I mistyped the second part.....the code is:



<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1") ;
if($_SERVER["REQUEST_METHOD"] == "POST"){
WA_DFP_UploadFile("WA_UploadResult1", "UserPhoto", "".((isset($_POST["UserPhotoDefault"]))?$_POST["UserPhotoDefault"]:"") ."", "../../../dB/ScientistPhotos/", "[FileName]", "0", "[FileName]_[Increment]", "500", "false", "0", "0");
}
?>
....

<input type="hidden" name="UserDefaultPhoto" id="UserDefaultPhoto" value="<?php echo $row_WAATKusers['UserPhoto'] ?> ">
<input class="noformstyle" type="file" name="UserPhoto" id="UserPhoto" size="30" >

Sign in to reply to this post

Jason ByrnesWebAssist

It is difficult to tell without seeing the code for the entire page.

Please compress the page ito a zip archive and attach it to your reply.

Sign in to reply to this post

michellem310468

page file attached...

Attached Files
users_Profile.php.zip
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...