PDA

View Full Version : Validation causes duplicate insert


andy.schofield283961
03-20-2010, 07:57 AM
I am having a problem where applying the validation toolkit is causing my standard dreamweaver insert behaviour to produce a duplicate record.

If I remove the validation toolkit from the form the form submit then it submits and inserts only a single record as expected.

I have cut the validation down to a single field length requirement on form submit, but still having no joy.

I have attached a copy of the .asp (with .txt extension to allow upload) file.

Can you please advise

Thanks

Andy

Jimmy Wu
03-22-2010, 10:31 AM
It doesn't look like the attachment worked. Make sure that the insert server behavior is not called before the validation code goes through. If the insert server behavior is before the validation code, at the top of the page, then it will insert and then the validation code will run and forward to the page and may be inserting again.

andy.schofield283961
03-22-2010, 05:18 PM
Could you see the code I attached, if you could point me to where the validation code begins or what it looks like I'll happily move it, just not sure what to look for and move to.

Any pointers would be great!

Thanks

Andy

Jimmy Wu
03-23-2010, 11:04 AM
I don't see an attachment still. Could you try attaching it again? Make sure its a valid attachment file extension.

andy.schofield283961
03-23-2010, 04:34 PM
I have re-added the attachment for you to review.

Thanks again for your help.

A

Jimmy Wu
03-26-2010, 01:42 PM
It appears that you have applied the validations to fire on the on click of the button. This doesn't prevent the form from being submitted, so the form will still submit with the incorrect values. If you change the validations to the onSubmit of the form, then the validation and insert should work correctly.

Basically on line 1363 of the form, you have onClick="<validation code>". You want to copy the <validation code> and put it in the onSubmit of the form on line 729.

andy.schofield283961
03-29-2010, 05:28 AM
Hi thanks for the response, i have tried your suggestion and re-uploaded modified page.

Still getting duplicate insert. Can you help please, i am so near to completing this page and this is my final issue.

Many thanks

A

Ray Borduin
03-29-2010, 08:06 AM
That looks correct. Do you have a page where we can view it live and test for ourselves? Have you looked in the error console to be sure there are no javascript errors? I think I would start with that.

andy.schofield283961
04-09-2010, 08:53 AM
Sorry I dont have a live server, I have looked all over but cannot stop this from occurring is there anything else you can do to help me on this as I'm really struggling.

Thanks

Andy

andy.schofield283961
04-12-2010, 05:19 PM
I can supply a copy of any page required as well as a copy of the DB if needed, just dont have a website i can direct you to currently.

can you please suggest how I can solve this issue...

Thanks

Andy

Ray Borduin
04-13-2010, 09:16 AM
Have you tried viewing the page and opening the javascript error console in firefox? That can often give you direction when debugging javascript problems like it appears you are running into.

Jason Byrnes
04-13-2010, 09:20 AM
one problem I can see that may be causing the problem, is that you have a badly named form element:
<input name="CR#" type="text" id="CR#" size="32">


form element names must conform to javascript variable naming rules:
1) Only use letters and numbers, the only exception is the underscore "_". spaces and other special characters must be avoided.

2) the first character must be a letter.

If you are still having problems, we really need to be able see the issue in a browser to be able to troubleshoot the cause of the problem.

andy.schofield283961
04-15-2010, 04:44 AM
Guys, any update on this issue, its causing me major issues now

Jason Byrnes
04-15-2010, 12:09 PM
did you see my previous reply:
http://www.webassist.com/forums/showpost.php?p=54030&postcount=12

andy.schofield283961
04-15-2010, 03:03 PM
Jason,

Hadnt seen your post, but your a star. Made the change and it worked first time. I'll continue to test and let you know. Thanks so so much.

Andy

Jason Byrnes
04-16-2010, 07:55 AM
excellent, glad to hear it is working.