Jump to content

2 java scripts in one php file


jeff5656

Recommended Posts

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?

 

The js scripts in the header:

<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:

<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:

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.