Jump to content

Disable A Form For Wrong Entry


Recommended Posts

Hi bookish,

 

Can you use drop-down lists instead of input fields?

You can use Lookup tables with variants of special diets and special room requests.

 

 

You can look for some words in the field with the following code:

<SCRIPT LANGUAGE="JavaScript">
function check_text()
{
var text_for_checking = document.getElementById("InsertRecordtext").value;
var wrong_answer = false;
if (text_for_checking.search("room")!=-1) {wrong_answer = true};
if (text_for_checking.search("floor")!=-1) {wrong_answer = true};
if (wrong_answer)
   {
      alert("Please specify your diet requirement.");
      return false;
   }
}
document.getElementById("caspioform").onsubmit=check_text;
</SCRIPT>

Please, enter the name of your field instead of text in the 

var text_for_checking = document.getElementById("InsertRecordtext").value;

 

You can add as many words as you wish, just copy the line

if (text_for_checking.search("room")!=-1) {wrong_answer = true};

and enter your word instead of "room".

 

To use a Java Script code, please add a Header&Footer element, select the Footer element, then click the Source button, and then enter a code. 
 
I hope it helps.
Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...

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

×
×
  • Create New...