close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

WA Server Validation Problem

Thread began 1/18/2016 10:14 pm by salaroche | Last modified 3/01/2016 11:46 am by Ray Borduin | 498 views | 18 replies |

salaroche

WA Server Validation Problem

Hi:

I have used WA Server Validations before with very good results, but not this time.

I’m trying to double check whether two data entered in an insert page already exist in a particular table in the db. The first is the month in a date field and the second is the username.

The month I get using a SELECT MID(Date(Now()),6,2) AS month1 and the second is stored in $_SESSION[‘MM_Username’]

Then I have a recordset “parsedMonth2 with these parameters:
SELECT pslip.date, pslip.username
FROM pslip
WHERE pslip.username = akauser AND MID(pslip.date,6,2) = colname

Akauser uses $_SESSION[MM_Username’] as Runtime Value and colname uses $_POST[‘month1’] as Runtime Value.

The WA Server Validation uses Validation Trigger = Current page submit; validation type = Number; and Server variable = $totalRows_parsedMonth2; Format = English (1,000.00); Minimum = -1; Maximum = 0; and Allow decimals = All.

What am I not doing right here?

The Validation should allow users to enter their data when the conditions username AND MID(date,6,2) are not given together. As it is, however, the Validation never allows for entering the data, even when the table is empty. It always sends users to the error-message page.

Attached please also find a copy of the Insert page that contains the validation.

Any suggestions?

Thank you for your attention

Attached Files
pslip_Insert.php
Sign in to reply to this post

Ray BorduinWebAssist

The order of the code is wrong... you will have to move the server validation code from lines 10-23 below the recordset code it is trying to validate.... also remove that stray br tag on line 24.

Sign in to reply to this post

salaroche

Ray:

Fantastic. Now it seems to be working OK.

Many thanks

Sign in to reply to this post

salaroche

Ray:

After installing Data Bridge in CS6 the server validation is back to rejecting all entries in the pslip_insert form. I double checked that the validation code is below the parsedMonth2 recordset and double checked the validation configuration and everything seems to be OK. Yet the validation behavior is not accepting any new records, is not redirecting to the SecondPSMessage.php, and no records are being inserted in the pslip table.

After pressing the "Submit" button the pslip_insert.php reappears with all fields empty.

What has gone wrong?

Attached please find a copy of the Insert page in question.

Attached Files
pslip_Insert.php
Sign in to reply to this post

Ray BorduinWebAssist

Is there a url where I can see the problem? I'll have to debug it live.

Sign in to reply to this post

salaroche

Ray:

Yes. Please see info below.

Sign in to reply to this post

Ray BorduinWebAssist

The validation works fine. The issue is the trigger for the insert. You have on line 201:

if (isset($_POST["Insert_x"]))

But your input button is named "Submit", so it should be:

if (isset($_POST["Submit_x"]))

Sign in to reply to this post

salaroche

Ray:

Yes, I made the change you suggested and things seem to be getting back to normal in the slip_Insert page, but the validation still allows for inserting second records for the same month without alerting the user, which it shouldn't.

Please try entering a record for username lulu and you'll see. Lulu already has records entered for the month of February, so the validation should send the user to the SecondPSMessage page, but it doesn't. It accepts the record.

Sign in to reply to this post

Ray BorduinWebAssist

You are filtering your Recordset with the value of: $_POST['month1']

on line 133, but that value is never submitted in the form. I'm not sure what you are trying to validate against, but that is why it never has a result and always passes validation.

Sign in to reply to this post

salaroche

OK. Can you see any error in this recordset? SELECT MID(Date(Now()),6,2) AS month1

It's giving a syntax error message: MySQL Error#: 1064. Yet when I test it it gives me the two digits for month.

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