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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

blocking duplicate entries

Thread began 9/14/2009 3:16 pm by un33k9309513 | Last modified 3/10/2010 2:01 pm by un33k9309513 | 3404 views | 13 replies |

un33k9309513

blocking duplicate entries

Hi,

I am trying to stop dulicate entries and I have the following server validation so far but it is blocking all entries. I also do have a recordset that filters based on the two columns I would like to block duplicate entries from.

<?php
if (isset($_POST["Submit"])) {
$WAFV_Redirect = "";
$_SESSION['WAVT_merch_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateNM(($totalRows_rsDuplicates) . "",0,0,"",",.",true,1);

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

Sign in to reply to this post

Jason ByrnesWebAssist

You have set the minimum and maximum to 0, try setting the minimum to -1 and the maximum to 0.


also make sure that the recordset code is before the validation code. If the recordset is created after the validation is performed, it will always fail.

Sign in to reply to this post

un33k9309513

I did set the min to -1 and that may have done it but I'm not sure because,
I have a select list that shows and hides two divs, but now it doesn't switch between the two to show/hide one or the other, this is what it has


<select name="type" id="type" onchange="WAValidateRX(document.forms[2].type,'select','/2/i','- Invalid entry',document.forms[2].type,0,true);WAValidateHD(document.forms[2].type,'sub_url',true);WAValidateRX(document.forms[2].type,'select','/2/','- Invalid entry',document.forms[2].type,0,true);WAValidateHD(document.forms[2].type,'sub_code',false)">
<option value="1" selected="selected">Code</option>
<option value="2">Print</option>
</select>


I noticed that after I added another form on my page that all the 1's where changed to 2's in the above so it used to be like this:


<select name="type" id="type" onchange="WAValidateRX(document.forms[1].type,'select','/2/i','- Invalid entry',document.forms[1].type,0,true);WAValidateHD(document.forms[1].type,'sub_url',true);WAValidateRX(document.forms[1].type,'select','/2/','- Invalid entry',document.forms[1].type,0,true);WAValidateHD(document.forms[1].type,'sub_code',false)">
<option value="1" selected="selected">Code</option>
<option value="2">Print</option>
</select>

By the way the duplicate entry is for both of these option values. These are regular expression validations on the select list like so in the behavior window:

onChange ----- regular expression
onChange ----- show/hide layer
onChange ----- regular expression
onChange ----- show/hide layer

Is there a place where I need to change a [1] to [2], I also just noticed if I have not submitted for a specific record it all works fine, but if I submit for a record then this problem occurs.

thanks

Sign in to reply to this post

Jason ByrnesWebAssist

It is using the forms[] collection which is an array containing all of the forms on the page.

If you a by the fact is has changed the [1] to a [2] it suggests that you added another form to the page before the one with the select lists in it.

it is hard to tell what the problem may be with out seeing the page, do you have a link you can send so I can see the code in context.

Sign in to reply to this post

un33k9309513

Yes the form I added is before the select list. I am running this page locally so I can upload the file but I didn't want to post it public. Is there a place that I need to update to the [2] also, I already updated the server validation and client validations to use [2].

if you can advise

Sign in to reply to this post

Jason ByrnesWebAssist

I am creating a support ticket so we can look into the issue further.

To view and edit your support ticket, log into your support history:
supporthistory.php

Sign in to reply to this post

un33k9309513

Thanks for the help Ray,

so I am updating this here As far as I can remember I hope I'm not missing anything here- the fix Ray helped me with is we had to change everywhere you see this:

.forms[1] to something else and that got it working. So,...


FROM THIS:

<select name="type" id="type" onchange="WAValidateRX(document.forms[1].type,'select','/2/i','- Invalid entry',document.forms[1].type,0,true);WAValidateHD(document.forms[1].type,'sub_url',true);WAValidateRX(document.forms[1].type,'select','/2/','- Invalid entry',document.forms[1].type,0,true);WAValidateHD(document.forms[1].type,'sub_code',false)">
<option value="1" selected="selected">Code</option>
<option value="2">Print</option>
</select>


TO THIS:

<select name="type" id="type" onchange="WAValidateRX(document.something.type,'select','/2/i','- Invalid entry',document.something.type,0,true);WAValidateHD(document.something.type,'sub_url',true);WAValidateRX(document.forms[1].type,'select','/2/','- Invalid entry',document.something.type,0,true);WAValidateHD(document.something.type,'sub_code',false)">
<option value="1" selected="selected">Code</option>
<option value="2">Print</option>
</select>

thanks

Sign in to reply to this post

un33k9309513

Well I thought I had it right, until I tried to submit an entry that was not in the table for a particular storeID but it was there for another storeID. So how can I block duplicate entries in the ccode column but only for the same storeID?

Here is the recordset I have for the duplicates recordset.

SELECT ccode
FROM visitorcodes
WHERE ccode = colname OR print = printcol

would I just have to set up something else in the WHERE clause like

WHERE ccode = colname OR print = printcol AND storeid = storecol

and then in the variable a $GET or $POST ?

I am trying to figure this out but it's kind of over my head

Sign in to reply to this post

Jason ByrnesWebAssist

Yes, that is it exactly.


Is the storeid stored in a post variable or a session variable?

Say you have a session variable named "storeid", the run time value for the storecol variable would be set to :
$_SESSION['storeid']

Sign in to reply to this post

un33k9309513

I don't think I have a session variable for storeid, but I used WA insert record wizard and I have the following set up:

session variable:
key column: VID
store as: vis_VID


I changed to this:

key column: VID
store as: vis_storeid

on my page's recordset I then put in:

$_Session['storeid']

For the type, I tried text and numeric neither worked.


The key column VID in my table is Not the storeid column, the key column is just there but I'm not using it for anything special I don't think.

When someone inserts a record it goes in the table but in WA insert record wizard on page 2 I have the storeid column set to this:

<?php echo $row_recordall['storeid']; ?>


I don't know how to check if the storeid is stored in a post or session variable..

anything I am not looking at right? Should I create a session variable, and how would I do that?

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