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

Server Validation Question

Thread began 5/19/2013 2:28 pm by Paul | Last modified 5/28/2013 10:47 am by Jason Byrnes | 576 views | 15 replies |

PaulBeta Tester

Server Validation Question

I'm after some guidance on how i can achieve following.

My logged in users are able to select tags from a drop down and im using INSERT to add their selection to a table.

The user ID is added along with the selected items ID

I want to prevent the user from selecting the same item 2 or more times from the drop down and adding it to their tag list.

I tried using validation on the selected item against a recordset that looked at the values already selected by the user, but that failed!

suggestions welcome.

Sign in to reply to this post

Jason ByrnesWebAssist

Originally Said By: Paul
  I tried using validation on the selected item against a recordset that looked at the values already selected by the user, but that failed!  



The recordset is the correct way to do it.

The recordset should be set to filter on the selection made and the users ID.

In the validation, use numeric validation.

for the server variable, use:
$totalRows_<recordsetName>

where <recordsetNamer> is the name of the recordset.

for the numeric validation, set the minimum to -1 and the max to 0. That will pass validation only if the Recordset does not return any rows.

Sign in to reply to this post

PaulBeta Tester

Ok, i'm not sure how to apply two filters, or can you explain a different way?

"The recordset should be set to filter on the selection made and the users ID."

Sign in to reply to this post

Jason ByrnesWebAssist

Use the advanced recordset dialog to create more than one filter.

Sign in to reply to this post

PaulBeta Tester

Hi Jason,

I've created a Recordset, including two filters, however the drop down is not populating from it.

Sign in to reply to this post

Jason ByrnesWebAssist

you should not be using this recordset to populate the dropdown,

it is only used to validate that selection.

to populate the dropdown, use another recordset.

Sign in to reply to this post

PaulBeta Tester

I think i see.

So ive populated my drop down with my tag options.

In the validation, use numeric validation, I have;

Sign in to reply to this post

Jason ByrnesWebAssist

please send a copy of the page so i can see the code in context.

Sign in to reply to this post

PaulBeta Tester

Attached

Sign in to reply to this post

Jason ByrnesWebAssist

The problem is code order.

The code for the server validaiton is at line 122 -137:

php:
<?php 

if (isset($_POST["Tag_submit"]) || isset($_POST["Tag_submit_x"]))  {
  
$WAFV_Redirect "";
  
$_SESSION['WAVT_index_902_Errors'] = "";
  if (
$WAFV_Redirect == "")  {
    
$WAFV_Redirect $_SERVER["PHP_SELF"];
  }
  
$WAFV_Errors "";
  
$WAFV_Errors .= WAValidateRQ(((isset($_POST["SelectTag"]))?$_POST["SelectTag"]:"") . "",false,1);
  
$WAFV_Errors .= WAValidateNM($row_rsDuplicate['usrtags_type'] . "",-1,0,"",",.",true,2);

  if (
$WAFV_Errors != "")  {
    
PostResult($WAFV_Redirect,$WAFV_Errors,"index_902");
  }
}
?>



this is after the code to insert the record which begins at line 84. Move the validation code to line 84 so the validation can take place before the record is inserted.

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