close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Insert Form WA Server Validations CSS Form Builder

Thread began 4/26/2010 1:33 pm by dlovas275157 | Last modified 4/29/2010 10:55 am by Jason Byrnes | 11024 views | 5 replies |

dlovas275157

Insert Form WA Server Validations CSS Form Builder

I am trying to do the following:

1. Create a form that inserts a record into my database table.
2. Apply CSS Form Builder to the insert form in order to add captcha to one of the textfields to prevent spam entries. and eventually add other form validations (email address)

I have manually created the form. Then ran it through css form builder and added the captcha. Then I rebinded the form fields generated by CSS FB to the insert record sb.

Problems:
1. On page load, the validation message for the captcha shows right away "Please enter a value" see screenshot
1. if you enter the captcha incorrectly, it redirects you to the existing page but without the correct record listing - it sends you to send.php and not send.php?send.php?gid=978
3. If you enter the captcha wrong it redirects you as stated above, and wipes out all entered form fields, so you have to start over.

Obviously I'm having issues with validations, I have read the various support articles but I cannot seem to find out how to fix. Thanks for any help.

Attached is my page code and screen shot.

Attached Files
send.php.zip
Sign in to reply to this post

dlovas275157

I just answered part of my question.

If you type in the wrong captcha, my form would redirect to send.php (current page - static url). But I needed it to redirect to a dynamic url such as send.php?gid=987

To accomplish this, I changed the the form's action from:

action="send.php">

to:

action="send.php?gid=<?php echo $row_rsGuns['id_inventory']; ?>"

Still working on other issues:
1. On page load, the validation message for the captcha shows right away "Please enter a value"
2. If you enter the captcha wrong it wipes out all entered form fields, so you have to start over.

Sign in to reply to this post

dlovas275157

Looks like I found out how to make sure form fields do not get wiped out if the captcha is entered wrong and the page has to reload due to wa server side validation.

To handle this, select each form field, and set its init value to its corresponding value in the WA Validation Entries recordeset (that is created when you run your form through CSS Form Builder.

For Example, my first form field is called "fromName".

Select the form field "fromName". Then in the properties inspector, where is says "init value", click the dynamic t-bolt next to it, and select the dynamic data field "WA Validated Entries > fromName".

Do this for all form fields that you do not want to loose the user's entry if the page has to reload.

Still have one problem left I need help with:
1. On page load, the validation message for the captcha shows right away "Please enter a value"

anyone know why? Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

validation failure is stored in a session variable, once you post the form and fail validation, it will display the errors every time the form is loaded, until you either close the browser completely, or post the form successfully.


another thing to consider is that the spry error and the server validation error are identical, theres no way to tell if it's a spry problem or server validation problem.


try changing:

php:
<span class="textfieldRequiredMsg">Please enter a value</span> </span>

                                      <?php
if (ValidatedField('send','send'))  {
  if ((
strpos((",".ValidatedField("send","send").","), "," "1" ",") !== false || "1" == ""))  {
    if (!(
false))  {
?>
                                        <span class="serverInvalidState" id="captcha_ServerError">Please enter a value</span>
                                        <?php //WAFV_Conditional send.php send(1:)
    
}
  }
}
?>



to:

php:
<span class="textfieldRequiredMsg">Please enter a value (Spry)</span> </span>

                                      <?php
if (ValidatedField('send','send'))  {
  if ((
strpos((",".ValidatedField("send","send").","), "," "1" ",") !== false || "1" == ""))  {
    if (!(
false))  {
?>
                                        <span class="serverInvalidState" id="captcha_ServerError">Please enter a value (Server)</span>
                                        <?php //WAFV_Conditional send.php send(1:)
    
}
  }
}
?>




temporarily so we can tell which is actually failing.

Can you also post a link?

Sign in to reply to this post

dlovas275157

The reason the "Please enter a value" error message for the captcha was showing on the first page load was because I did not have a "Validation Show If" conditional surrounding it. The validation rule was set up in the WA Server Validations SB, but I just hadn't added the conditional yet. (i'm new to learning how the validation extensions work)

After building the insert record form, and running it through CSS Form Builder, somehow I had a combination of "Spry Validations" and "WA Server Validations". This was confusing to me.

To simplify things, I decided to remove all "Spry Validations" and only use "WA Server Validations" for any of the fields that needed validating. After doing so, my form works as needed.

My validations were on the following fields:
fromName textfield - required
fromEmail textfield - email required
captcha - Like Entry

Is there a disadvantage to only using Server Validations?

Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

no, there are no disadvantages to using only server validation.

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