Results 1 to 4 of 4

Thread: onsubmit in code

  1. #1
    Join Date
    Feb 2008
    Posts
    62
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default onsubmit in code

    hi ! i have any code for lightbox ! this worked with : onclick="loadingPanel.show()
    now i have other code for enable or disable content with java script ;
    Code:
    <script language="javascript" type="text/javascript">
    	var the_form	= window.document.LISTFORM;
    	var filter_form	= window.document.FILTERFORM;
    
    	select_list("{FSTATUS}", filter_form.fstatus);
    	select_list("{FARCHIVED}", filter_form.farchived);
    	select_list("{FCAT_ID}", filter_form.fcat_id);
    
    	function updateForm(the_url){
    		if ( !is_checked_item(the_form) ){
    			alert('CHOOSE_ITEM');
    		}
    		else{
    			the_form.action = the_url;
    			the_form.submit();
    		}
    	}
    	
    	function deleteForm(the_url){
    		if ( !is_checked_item(the_form) ){
    			alert('CHOOSE_ITEM');
    		}
    		else{
    			if ( confirm('YES or NO') ){
    				the_form.action = the_url;
    				the_form.submit();
    			}
    		}
    	}
    </script>
    now ! how to add onclick or onsubmit in javascript code ?? NOTE : not add onclick in form ! after click Yes onclick="loadingPanel.show()

    thanks

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Can you use proper grammar please, I didn't understand a sentence you said. Sorry if that offends you.
    Jeremy | jfein.net

  3. #3
    Join Date
    Jun 2008
    Posts
    589
    Thanks
    13
    Thanked 54 Times in 54 Posts
    Blog Entries
    1

    Default

    DD Member, might I ask that you not post threads that do not ask for help. If you want to do this, please post the thread in the Lounge.

    This is just telling you that you must post things that have no specific meaning for people to help you in the Lounge.

    Just saying. Note that this is important.

    But, okay. Nice code!!

    -magicyte

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by why not View Post
    how to add onclick or onsubmit in javascript code ?? NOTE : not add onclick in form ! after click Yes onclick="loadingPanel.show()
    Well, say your form is (as you defined it):

    Code:
    var the_form	= window.document.LISTFORM;
    Which should be the same as (the preferred):

    Code:
    var the_form = document.forms['LISTFORM'];
    Then you can:

    Code:
    the_form.onsubmit = function(){
    code here to run on submit;
    };
    Or, if you already have defined a function that requires no arguments, like say - loadingPanel.show(); - then you can do:

    Code:
    the_form.onsubmit = loadingPanel.show;
    Note: When doing it this second way, you cannot use () or any arguments, and the event object will be passed as the first argument to the function, except in IE, where it will be available as window.event if needed.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •