Skip to main content
ExLibris
  • Subscribe by RSS
  • Ex Libris Knowledge Center

    How to make a field mandatory in an OPAC form?

    • Article Type: General
    • Product: Aleph
    • Product Version: 20

    Desired Outcome Goal:
    How to make a field mandatory in an OPAC form?

    Procedure:
    To make a field mandatory in an OPAC form follow these steps (example is for form “feedback”):

    1. Change in $alephe_root/www_f_lng/feedback the form tag so that you have in line onsubmit the following:
    onsubmit='return checkMail();'

    2. Add the following Java Script to head of the above file:

    <script language="javascript">
    function checkMail() {
    if (document.form1.TARGET.value == '') {
    alert('E-Mail is missing');
    return(false);
    }
    else document.form1.submit();
    }
    </script>

    Explanation:
    *checkMail is a free chosen name for the script
    * form1 is the name of the form
    * TARGET is the name of the field for the mail address
    * For ALERT you can choose any warning text

    Category: Web OPAC (500)


    • Article last edited: 10/8/2013