I have a calendar pop
js and and required field
js. For some reason, adding the calendar one makes the other one not work. I am sure it has something to do with the code near the submit button?
- Code: Select all
<SCRIPT LANGUAGE="JavaScript" SRC="../CalendarPopup.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
var cal = new CalendarPopup();
</SCRIPT>
<script type="text/javascript" src="../formvalidator.js"></script>
<script type="text/javascript">
<!--
function check(formname, submitbutton) {
var errors = '';
errors += checkText(formname, 'your_name', 'Your Name');
errors += checkText(formname, 'mrn', 'MRN');
errors += checkText(formname, 'name', 'Your Name');
errors += checkText(formname, 'card_no', 'Card No.');
return checkThisForm(formname, submitbutton, errors);
}
//-->
The key parts of the form:
- Code: Select all
<form id="cin" name="cin" method="post" action="cin_addpatient.php">
<table>
<th>Your Name</th>
<td><input type="text" name="your_name" /></td>
</tr>
<tr></tr>
<th>Patient Last Name</th>
<td><input type="text" name="name" /></td>
</tr>
<tr></tr>
<th>Card No.</th>
<td><input type="text" name="card_no" id="card_no" /></td></tr>
<tr></tr>
<th>Date of enrollment</th>
<tr>
<td><input type="text" name="date_enroll" id="date_enroll" /> <A HREF="#"
onClick="cal.select(document.forms['cin'].date_enroll,'anchor1','MM/dd/yyyy'); return false;"
NAME="anchor1" ID="anchor1"><img src="../calendaricon.gif" width="16" height="16" border="0"></A></td></tr>
and the code near the submit button:
- Code: Select all
<input type="submit" name="Submit" value="Add Patient" onClick="return check('newreminders', this.name)">
The calendar script works on the form, but not the required fields. If I don't enter something, the form still gets processed.