April 24, 200223 yr I have to validate a field in a form, I beleive that my problem is not solvable with Javascript. The form is a competition which all entrants only can apply once. And the only workable solution to that is to make sure that people can't enter with the same e-mail address twice. The form and format page have to check if someone tries to enter the competition twice (or more) with the same e-mail address. I have javascript validation on all the required fields (such as name, phone ...) and I've tried to use the FMP control attributes on fields (such as: required value, not-empty and so on). But all that happens is that I can get the format page use the error code sent out by WC (code 504) and print: "You have already answered... you bastard", but the information with the same e-mail address is added to the database. The only difference is that it doesn't contain the duplicate e-mail address. Is there anyway I can stop FMP from adding that post?
April 24, 200223 yr You can apply a 'Unique' validation in 'Define Fields' for the email field. When a duplicate is submitted and error will be returned. Hope this helps. Garry
April 25, 200223 yr Gary, Won't that hang the server? I thought they popped up an error message on the server and hung there until someone clicked okay. That being an os9.x server of course. Does this still happen in Unlimited?
April 25, 200223 yr Dan, It shouldn't pop-up on the server if you are using WebCompanion (cdml). The error will be sent to the browser. Hence, you will be able to capture this with "-error". Hope this helps. Garry
April 26, 200223 yr FWIW, I just tested this concept on Internet Explorer. My -error page was not returned. Instead I got a pop-up window "Internet Explorer Script Alert" which had the message, "Your attempt to edit a record failed because of the following: "Not unique value on field "expire" "
April 26, 200223 yr I've just had a chance to do my own test with: <form action="FMPro" method="post"> <input type="hidden" name="-db" value="combotest.fp5"> <input type="hidden" name="-lay" value="web"> <input type="hidden" name="-format" value="hworld2.html"> <input type="hidden" name="-error" value="fmperror.html"> <input type="hidden" name="-recid" value="[FMP-CurrentRecID]"> Field b1: <input type="text" name="my_rec_serial#" value="[FMP-Field: my_rec_serial#]"> <input type="submit" name="-edit" value="Edit"></form> Here is the fmperror.html contents: </head> <body> Error [FMP-CurrentError] </body> It is working OK for me; it returns error code 504. I am using FMP 5.5v2 on Mac OS X. All the best. Garry
Create an account or sign in to comment