File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

onSubmit event on form

 
ravindra patil
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please add the code tags as instructed. I will not look at the code without them.
 
ravindra patil
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still no code tags? Do you want help or not?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.
 
ravindra patil
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic