[SOLVED] why onclick is not called - Help Please

This is a discussion on "[SOLVED] why onclick is not called - Help Please" within the JavaScript Forum section. This forum, and the thread "[SOLVED] why onclick is not called - Help Please are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 15th, 2007, 11:35
New Member
Join Date: Nov 2007
Location: Hyderabad
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] why onclick is not called - Help Please

HTML: Select all
<form name="frmAdd" method="post" action="<%=basePath%>adduser.do">
        <table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" class="border1">
          <tr> 
            <td width="31%" class="txt"><strong>User Type</strong>&nbsp;&nbsp;&nbsp;&nbsp; 
            </td>
            <td width="69%">
                <input type="hidden" name="id">
                <input type="hidden" name="flag" value="add">
                <input id="iptUser" name="usertype" type="text" class="input" id="user2" size="30">
            </td>
          </tr>
          <tr>                             
            <td valign="middle" colspan="2" align="center"> 
              <input name="btnAdd" type="button" class="button" value="&nbsp;&nbsp;&nbsp;Add&nbsp;&nbsp;&nbsp;" width="50" onclick="addUser();"> &nbsp;&nbsp; 
              <input name="btnSave" type="button" class="button" value="&nbsp;&nbsp;Save&nbsp;&nbsp;" disabled="disabled" width="50" onclick="addUser();"> 
              &nbsp;&nbsp; 
              <input name="btnClear" type="button" class="button" value="Cancel" width="70" onclick="clear();">  &nbsp; 
            </td>              
          </tr>      
        </table></form>

functions Are :

HTML: Select all
function addUser(){ 
            var user =    document.forms.frmAdd.usertype.value;
            if(user == ""){
                alert("Please Enter a User Type First");    
            }else{                
                document.frmAdd.submit();
            }            
        }
        
        function clear(){
           alert("inside reset");           
        }
Here addUser() is called, but not clear()...

Any Idea, Please. Can we have more than one button in a form like what I have ?
Reply With Quote

  #2 (permalink)  
Old Nov 16th, 2007, 05:50
Up'n'Coming Member
Join Date: Jun 2007
Location: Germany
Age: 22
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Lucleonhart Send a message via MSN to Lucleonhart
Re: why onclick is not called - Help Please

That is, because "clear" is a predefined function! You cannot use predefined names for your own functions. Simply rename it to something unique like "clear_form()".
Reply With Quote
  #3 (permalink)  
Old Nov 16th, 2007, 06:02
New Member
Join Date: Nov 2007
Location: Hyderabad
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Re: why onclick is not called - Help Please

Thanks Lucleonhart,

Thanks for your help...
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I find what another frame is called? Crow555 Classic ASP 2 May 13th, 2008 08:22
[SOLVED] editUser() function not called, Help Please ashishmishra16 JavaScript Forum 2 Nov 16th, 2007 06:04
Login prompt when not called EXDunk Flash & Multimedia Forum 0 Feb 26th, 2007 20:37
IPostBackDataHandler.LoadPostData never called flyingHigh Webforumz Cafe 0 Jan 29th, 2007 11:35
not sure what its called but i can show you what i mean bruno89 Web Page Design 12 Oct 17th, 2006 07:15


All times are GMT. The time now is 10:11.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43