iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack Thread Tools
Old November 15th, 2007, 08:35 AM   #1
New Member
 

Join Date: Nov 2007
Location: Hyderabad
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 ashishmishra16 is on a distinguished road
[SOLVED] why onclick is not called - Help Please

HTML Code:
<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 Code:
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 ?
ashishmishra16 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 16th, 2007, 02:50 AM   #2
WebForumz Member
 

Join Date: Jun 2007
Location: Germany
Age: 24
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Lucleonhart is on a distinguished road
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()".
Lucleonhart is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 16th, 2007, 03:02 AM   #3
New Member
 

Join Date: Nov 2007
Location: Hyderabad
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 ashishmishra16 is on a distinguished road
Re: why onclick is not called - Help Please

Thanks Lucleonhart,

Thanks for your help...
ashishmishra16 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
[SOLVED] editUser() function not called, Help Please ashishmishra16 JavaScript 2 November 16th, 2007 03:04 AM
Login prompt when not called EXDunk Flash and ActionScript 0 February 26th, 2007 05:37 PM
IPostBackDataHandler.LoadPostData never called flyingHigh The Café 0 January 29th, 2007 08:35 AM
not sure what its called but i can show you what i mean bruno89 HTML, XHTML and CSS 12 October 17th, 2006 04:15 AM


Search Engine Optimization by vBSEO 3.2.0 RC8