wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes onSubmit event on form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "onSubmit event on form" Watch "onSubmit event on form" New topic
Author

onSubmit event on form

ravindra patil
Ranch Hand

Joined: Sep 01, 2006
Posts: 228
I have form with two <select> tags
and others are text boxes

onChange on first select i am submiting the form

i want to call another javascript method when forms get submitted that means onSubmit even of form ,
but its not happening

here is the code



help
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.

Are you saying the form is not being submitted? Or are you saying the form's "onsubmit" method isn't being called? If the latter, you'll need to call reportTypeChange from within the selectSubstances method.
ravindra patil
Ranch Hand

Joined: Sep 01, 2006
Posts: 228
yes onSubmit is not getting called , but how can i call that reportTypeChnage() from selectSubstance() as in selectSubstance() i am submitting the form.
should i call that method after my submit method ??
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

Please add the code tags as instructed. I will not look at the code without them.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
ravindra patil
Ranch Hand

Joined: Sep 01, 2006
Posts: 228
ok i have form

<form name="myForm">
<select name="sel1" onChnage="even1()">
<option value="1">1</option> </select>

<select name="sel2" onChnage="even2()">
<option value="2">1</option> </select>

function even1()
{
document.myform.submit();

}

function even2()
{
document.getElementById("elem").style.display="block";

}
</form>
so the problem is when even2 gets call it show that HTML elem
but when i clicks on sel1 form is geeting submitted which doesnot retaind my data as form gets submitted
so itied to call even2 on onSubmit form but its not getting called

even i tried to call both even1 and even2 on onchange of sel1 but it tmeporary shows it and again disappers

what to do ?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

Still no code tags? Do you want help or not?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
If you submit the page everything gets reset, you need to select the values on the server.

Please edit your last post to use code tags. I did your first post and you can see how pretty it looks!

Click the edit button in your post, select the code in the textarea with your mouse, and click the code button in the toolbar. It is not that difficult.

Eric
ravindra patil
Ranch Hand

Joined: Sep 01, 2006
Posts: 228
.
ravindra patil
Ranch Hand

Joined: Sep 01, 2006
Posts: 228
Ok i have put the code as per your demand

Now the problem is when even2 gets call it show that HTML elem
but when i clicks on sel1 form is geeting submitted which doesnot retaind my data as form gets submitted
so i tied to call even2 on onSubmit form but its not getting called

even i tried to call both even1 and even2 on onchange of sel1 but it tmeporary shows it and again disappers
i just want to retained my data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: onSubmit event on form
 
Similar Threads
invoke a java function onSubmit of the form
I am getting text box value null when set by javascript
toughie..JSP in Javascript Dynamic Drop Down List
HTML
Combo box problem