Jump to content

Is It Possible To Deny Submission, If A Checkbox Is Checked?


Recommended Posts

Hi everyone,

 

I am creating a catalog of books.

I have a Submission form, and one of my questions is "Is the same book already added to the catalog?", it is a check-box form element.

If a user checks the checkbox, I want to display an error message "Please don't duplicate books" and if a user clicks the Submit button, I want to display another error message "Because the same books is already added to the catalog, please don't duplicate books".

 

I believe, it is possible in Caspio but I cannot find the script in the forum.

 

Thank you for your time!

Link to comment
Share on other sites

Hello Cameron! 

 

Hope you are doing well. 

 

I have suggestion, which might help you . When a User selects No, he will receive a warning message and a Submit Button will be disabled. Then, if he selects Yes, a Submit Button will appear again. There is a script: 

<SCRIPT LANGUAGE="JavaScript">

function MyFunction()

    {
            if (document.getElementById('InsertRecordYes_No').checked)
              {
             document.getElementById("Submit").style.display = "none";
             alert(" You cannot submit a form. Please select NO ");
             return false;
                  }
             else {
                  document.getElementById("Submit").style.display = "inline";
                          }

     }


document.getElementById('caspioform').onchange=MyFunction;


</SCRIPT>

I hope it is what you need. 

 

Best, 

 

Aurora

Link to comment
Share on other sites

I hope it is what you need. 

 

Aurora

 

Hello Aurora!

 

Wow!

It is perfect!

Thank you for your time!

 

 

Hi Cameron,

 

Does the user have to enter any kind of code that would be unique to each book?

 

If so you can mark it as a unique field and people will be unable to save entries with duplicates.

 

Hi DataCobalt!

 

Thank you for your time and for your advice!

Yes, it is ISBN. But if the book is published by another publisher, it has another ISBN, but in fact it is the same book, I mean, the author and the content are the same.

Maybe, I need to invent some unique id for books.

 

Thank you!

Link to comment
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...
 Share

×
×
  • Create New...