Ovidium Posted February 26, 2014 Report Share Posted February 26, 2014 Hi, I need to set a field in an update form to accept specific content in a format 3 letters 3 numbers i.e. "AAA111" The input also has to be validated against an existing table that contains that information as unique records, i need help setting the field to accept input only in this format, probably then i may be able to enforce a validation against the existing table, please help. Thank you Quote Link to comment Share on other sites More sharing options...
Jan Posted February 28, 2014 Report Share Posted February 28, 2014 Hello Ovidium, If I understand correctly, you can try next steps: 1) In the table, set the field as unique (in the Table Design tab, select the Unique check box). 2) On the Configure Fields page of the Wizard, select the field and enter 6 to the Character length - Max field. 3) Add Header and Footer, in the Footer, enter the code like <SCRIPT LANGUAGE="JavaScript"> function checkInput() { var text = document.getElementById("InsertRecordFIELDNAME").value; var pattern = /^[A-Za-z]{3}[0-9]{3}$/; if (pattern.exec(text) === null) { alert('Please, enter data in format AAA111'); return false; } } document.getElementById("caspioform").onsubmit=checkInput; </SCRIPT> Enter the name of your field instead FIELDNAME. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.