@{
If (f1) // What should i write here if i want to execute code if comes from form f1
{
}
else if (f2) // What should i write here if i want to execute code if comes from form f2
}
<html>
<form id="f1" name ="f1" action="" method="POST">
<input type="text" name ="name" value="name" />
<input align ="center" type="submit" value='Submit'/>
</form>
<form id="f2" name ="f2" action="" method="POST">
<input type="text" name ="profession" value="profession" />
<input align ="center" type="submit" value='Submit'/>
</form>
</html>
I want to execute a code on the basis of form submission .
if(!Request["f1"].IsEmpty()){ //form f1 submitted }else if(!Request["f2"].IsEmpty()){ //form f2 submitted }
This didnt work for me but after changing a little it work for me :) Thanks alot :)
Although the code that TOMCIO may not have worked for you, he used the code that you supplied. So the fact that it didn't work is your fault. Also, if he hadn't given you the answer, you wouldn't have come up with 'your' answer. He fully deserves to have
been set as the answer and not you.
uahmed
Member
21 Points
14 Posts
handling multiple submit in one form
Mar 14, 2012 08:07 PM|LINK
Hi
I want to handle multiple submit in one form
@{ If (f1) // What should i write here if i want to execute code if comes from form f1 { } else if (f2) // What should i write here if i want to execute code if comes from form f2 } <html> <form id="f1" name ="f1" action="" method="POST"> <input type="text" name ="name" value="name" /> <input align ="center" type="submit" value='Submit'/> </form> <form id="f2" name ="f2" action="" method="POST"> <input type="text" name ="profession" value="profession" /> <input align ="center" type="submit" value='Submit'/> </form> </html>I want to execute a code on the basis of form submission .
stevenbey
All-Star
16526 Points
3378 Posts
Re: handling multiple submit in one form
Mar 14, 2012 08:14 PM|LINK
Please see my blog post on how to handle this situation.
http://stevenbey.com
Recursion: see Recursion
TOMCIO
Contributor
3648 Points
833 Posts
Re: handling multiple submit in one form
Mar 14, 2012 08:15 PM|LINK
if(!Request["f1"].IsEmpty()){ //form f1 submitted }else if(!Request["f2"].IsEmpty()){ //form f2 submitted }
Web: Chicago Website Design
r@zorC - Open Source ASP.net CMS for WebMatrix
uahmed
Member
21 Points
14 Posts
Re: handling multiple submit in one form
Mar 14, 2012 11:23 PM|LINK
This didnt work for me but after changing a little it work for me :) Thanks alot :)
uahmed
Member
21 Points
14 Posts
Re: handling multiple submit in one form
Mar 14, 2012 11:24 PM|LINK
if(!Request["name"].IsEmpty()){ <h1>Form 1</h1> } if(!Request["profession"].IsEmpty()){ <h1>Form 2</h1> }stevenbey
All-Star
16526 Points
3378 Posts
Re: handling multiple submit in one form
Mar 14, 2012 11:35 PM|LINK
Although the code that TOMCIO may not have worked for you, he used the code that you supplied. So the fact that it didn't work is your fault. Also, if he hadn't given you the answer, you wouldn't have come up with 'your' answer. He fully deserves to have been set as the answer and not you.
http://stevenbey.com
Recursion: see Recursion