//Use the old validation script if no parameter sent (backward compatibility) //if we want to use the "old" validate function (set in globals) the validate function that will be called is the one that // was on code up to today (the validat library was not loaded ( look at the top of this file) if (new_validate !== 1) { var f = document.forms[0]; if (validate(f)) { somethingChanged = false; top.restoreSession(); f.submit(); } else { //If there was an error prevent the form submit in order to display them e.preventDefault(); } } else { //If the new validation library is used : <?php /*Get the constraint from the DB-> LBF forms accordinf the form_id*/ $constraints = LBF_Validation::generate_validate_constraints($form_id); ?> //Variables used for the validation library and validation mechanism var valid = true ; var constraints = <?php echo $constraints; ?> ; //We use a common error for all the errors because of the multilanguage capability of openemr //TODO: implement a traslation mechanism of the errors that the library returns var error_msg ='<?php echo xl('is not valid'); ?> '; var form = document.querySelector("form#"+form_id);
} ?> dlgopen(url, '_blank', 700, 500); } //--> </script> </head> <body class="body_top"> <?php /*Get the constraint from the DB-> LBF forms accordinf the form_id*/ $constraints = LBF_Validation::generate_validate_constraints("DEM"); ?> <script> var constraints = <?php echo $constraints; ?> ; </script> <form action='new_comprehensive_save.php' name='demographics_form' id="DEM" method='post' onsubmit='return submitme(<?php echo $GLOBALS['new_validate'] ? 1 : 0; ?> ,event,"DEM",constraints)'> <span class='title'><?php xl('Search or Add Patient', 'e'); ?> </span>