|
-
October 6th, 2002, 05:33 AM
#1
Action from Input Submit Button
Can you have more than one Action from an Input Submit Button?
If so, How is this done?
-
October 7th, 2002, 07:09 AM
#2
No,
it's pretty much the same reason you can't have two bgcolor properties in the body tag, it will only accept one (if it accepts either, im not sure how it would handle that). Really, what you're doing when you say action= is setting a variable, if you do it twice you set it to either 2 different values, or only the second one will take precedence...once again im not sure how it works.
Last edited by Waldo2k2; October 7th, 2002 at 07:11 AM.
C G C F A D--Feel the Noise
"When your life goes nowhere and leads back to me, doesn't that tell you something?"
~Gray Area Fury
-
October 7th, 2002, 09:58 AM
#3
Yes, I see what you mean.
I thought you could execute 2 or more actions sequentially.
-
October 7th, 2002, 03:12 PM
#4
When you say "more than one Action" do you mean that the <form> tag would have:
<form name="foo" method="post" action="page1.jsp, page2.jsp">
If so, then the answer is definitely no. But page1.jsp could call page2.jsp so you have the same effect.
If by "more than one Action" you meant more than one operation- for example when the submit button was pressed, something was done on the client first, then the action was called. This can be done by calling a JavaScript function in the onSubmit event handler, which would be handled first before the action.
If by "more than one Action" you meant could the action be variable? Then the answer is yes, as you could make the action depend on some server-side condition:
<% if (goToPage1) { %>
<form name="foo" method="post" action="page1.jsp">
<% } else { %>
<form name="foo" method="post" action="page2.jsp">
<% } %>
-
October 8th, 2002, 09:55 AM
#5
AAhh! All I really want to do is on the click of a button, I download three different file from my WEB space. I can do it now by having three buttons but I want to do it with one click and one button??
-
October 8th, 2002, 10:37 AM
#6
That's more like it. Why didn't you say so in the first place??
Why not just make a ZIP file of the three files and have the action be to download the ZIP file?
-
October 8th, 2002, 05:49 PM
#7
some people don't have zip utilities...
you can wrap everything into one function, i'm not sure how download requests work, i'll leave that part to you...but do this
Code:
//put this function in the onclick handler in your html
function getEmAll()
{
//note: function names are substituted, i don't know what the real names are
if (getFileFunction()==0)
{
//if it returns true, that means they got the first file, so do the next one
if (getFileFunction()==0)
{
if (getFileFunction()==0)
{
return true;
}
}
}
else
{
return false;
}
}
//returns true if it got through all three requests, false otherwise
like i said that's not real code, but it's how you should set up yours
C G C F A D--Feel the Noise
"When your life goes nowhere and leads back to me, doesn't that tell you something?"
~Gray Area Fury
-
October 9th, 2002, 06:58 PM
#8
if (getFileFunction()==0) {
//if it returns true, that means they got the first file, so do the next one
if (getFileFunction()==0) {
FYI.... In JavaScript, 1 is true and 0 is false. Replace the 0's with 1 (or true)!
As for the download requests, you could just do a window.location and, depending on the mime type of the file, set the content disposition in the HTTP header.
-
October 9th, 2002, 09:47 PM
#9
wow...didn't know that javascript was the other way around with the one's and zero's....that explains a lot
C G C F A D--Feel the Noise
"When your life goes nowhere and leads back to me, doesn't that tell you something?"
~Gray Area Fury
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|