Jump to content

Recommended Posts

 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

Link to post
Share on other sites
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.

Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...