Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML JavaScript

error checking give me headache..!!!

Javascript coding ..

Moderators: macek, egami, gesf

error checking give me headache..!!!

Postby fixaded » Wed Aug 10, 2005 11:09 pm

alo guys...can you guys help me regarding my error checking.. i dont know whats wrong with it..my form has two submit buttons which are SAVE and SEARCH. for the SAVE button, all the input key in by the users need to be validate using my error checking function. but for the SEARCH button, no error checking needed. the problem now is when i trying to input data to save i to database. if i'm not key in the data completely, the error message will come out and save to the database. i dont want it to be like that. i want the user key in all right input or key in completely and then he/she can only save their data. can anybody tell me what is te problem with my codes..below is codes attached:

*******************************************************************************************************
Code: Select all
..//php codes.
...
...
...
...
<html>
<head>
   <link rel="stylesheet" href="css/std.css"; type="text/css"/>
 
<script language="JavaScript">
var f = document.calform;
function valForm(f)
{

   if (f.w0.value == "") {
      alert("Please enter your ID!");
      f.w0.focus();
      return false;   }
   if (f.w1.value == "") {
      alert("Please enter your Name!");
      f.w1.focus();
      return false;   }
   if (f.w2.options[f.w2.selectedIndex].value == 0) {
      alert("Please select one of the shift from the Shift ");
      f.w2.focus();
      return false; }
   

   return true;
};
</script>    
</head>
<body>
<form method="post" action="shifthandover.php">
  .....
.....
...
.....
.....//my table

      <tr class="lbg">
          <input type="button" name="process" value="New" onClick="window.open('shifthandover.php','_self');"/>
          <input type="submit" name="process" value="Save" onClick="valForm(this.form); this.form()"/>
          <input type="submit" name="process" value="Search"/>
         
       
        </td>
      </tr>
     
     <tr>
        <td colspan=2> </br> </td>
      </tr>
   
        <td colspan=2> </br> </td>
      </tr>
    </table>
   
  </div>
</form>
</bodY>
</html>
User avatar
fixaded
New php-forum User
New php-forum User
 
Posts: 47
Joined: Sun Jun 19, 2005 6:53 pm

Postby gesf » Thu Aug 11, 2005 10:22 pm

I'm not sure if i unederstood your point, however let me say that you can't use html tags with the same name like you're doing in your 3 form inputs. Also you should have only one submit input. Change your 'save' input to button type.
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby fixaded » Sun Aug 14, 2005 12:37 am

owh...i think i already fix that proble.m.. :D tq gesf
User avatar
fixaded
New php-forum User
New php-forum User
 
Posts: 47
Joined: Sun Jun 19, 2005 6:53 pm

Postby Alexej Kubarev » Sun Aug 14, 2005 1:23 am

Use CODE TAGS :-x
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län


Return to JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron