close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Help creating a form using lookup codes

Thread began 3/06/2012 6:18 am by saf01 | Last modified 3/13/2012 2:27 pm by Jason Byrnes | 1410 views | 15 replies |

saf01

Help creating a form using lookup codes

Hi. I want to create a registration form, without the need for username and password.

The user will already have a code that is emailed to them. The database contains the code.

The registration is only successful if the code entered on the code field on the form matches the one in the database otherwise the user cant register.

Please advise. Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

create form field to enter the code, and a recordset that will query the table holding the codes and filter it using the form element.


then in server valadtion, add numeric validation. set the server variable to "$totalRows_recordsetName" where recordsetName is the name of the recordset, set the minimum to 1 and the max to 100, this will pass validation only if he code is found in the database.

Sign in to reply to this post

saf01

Thx for answer. Im really struggling with this. Ive created the form using CSS Form Builder 2 and added UE behaviour to it. Im going to add Datassist > Insert > Single Record Insert after I know this thing works.

Ive created a Recordset in Simple mode and then how do I filter using the form field (my form field is called txt_VCode?

In the server validation I already have a another WA Server Validations - do I add the new Server Validation to this one or do I add a new numeric validation as in:

Server Validations > Webassist > Validation > Server Validation ?

Please advise

Sign in to reply to this post

Jason ByrnesWebAssist

in the recordset simple mod, set the filtering section to use the column that contains the code, then set it to Form variable and enter the form elements name:
txt_VCode



since you already have validation on the page, edit the server validation by clicking it on the server behaviors panel to add the new numeric validation.

Sign in to reply to this post

saf01

Alright I went ahead and did exactly as described. If I add the correct code and fill in the rest of the form i keep getting register.php?invalid=true

Cannot modify header - header already sent error.

Is there anyhting I can do here? Cheers

Sign in to reply to this post

Jason ByrnesWebAssist

see the following page for details on the headers already sent error:
showthread.php?t=19285



for the validation, inspect the page code and make sure that the recordset code comes before the validation code.

if you continue to have a problem send a copy of the page so i can see the code.

Sign in to reply to this post

saf01

Hi Jason,

I remade the entire form from scratch - now I have no more errors and everything works as expected - tested, if the code is not entered correctly the form does not send, if the code entered correctly it sends email. My code field is alphanumeric, so I added an alphanumeric validation instead of numeric, it still works.

Is there a way I can add a message next to the Code field that says Invalid code if the code entered does not match the code in the database after hitting submit? I have Form Toolkit but, not sure about the redirect page part of it.

Thanks you very much for your help.

Sign in to reply to this post

Jason ByrnesWebAssist

yes, use the validation show if server behavior to show validation errors if validation fails.

Sign in to reply to this post

saf01

Thx for your help that worked.

Please can you help with this small thing. I have now another page, this page is a very simple datassist results page only with a recordset that list all items from a database with a repeat region. I want to add a link or button within the repeat region so when a user clicks on this button one of the fields (item name) on the VCode registration form is automatically filled with the name of the item the user has clicked on from the data assist results page?

EDIT: Its ok now Ive managed to do this - I added the same recordset that was on the results page to the register form page but did a URL parameter filter. On the results page I added a hidden field with the itemid and same on the form page on the item name field. Now I can pass the item id and name.

Please can you tell me how I can remove the Vcode from the database once the form has been posted - is this an easy thing to do? Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

add a delete record behavior, set the Key Column to the column that contains the code, set it to use the code form element. you will need to make sure that the delete behavior code gets added after the insert code.

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