Solved

two ACTIONs

Posted on 2000-03-02
12
201 Views
Last Modified: 2013-12-25
Can I have two actions in <form ACTION.....> tag
Example
<form action="/cgi-bin/account_request.pl" now anotherone>
explanation: need to execute completely different programs from
data input form (cgi and ASP)
Please supply correct syntax if any or workaround.
Thanks
0
Comment
Question by:mativare
  • 5
  • 4
  • 2
  • +1
12 Comments
 

Expert Comment

by:lorentg
ID: 2578760
Not as such
0
 

Expert Comment

by:lorentg
ID: 2578763
PS - the html spec is clear that there is only one action for a <form tag>  

Now, there are kludges that can be used to make it appear that there are two actions.  The most commone ones are:

a) have the script called by the first action make a page that includes a <meta tag, or javascript that invokes the second.

b) have the submit button actually invoke a JS function rather than really do the submit.  Then the function does the submit after doing a form.submit() in another, hidden window for the other action.
0
 
LVL 1

Author Comment

by:mativare
ID: 2580320
Please supply JavaScript example how to do it
<form action="/cgi-bin/account_request.pl" + x.asp>
Thanks
0
 
LVL 8

Expert Comment

by:jhurst
ID: 2581406
Here are three html files:

test.htm will create a minimal size/not visible frame at the top and the one you see at the bottom:

<html>
<frameset rows=200,*>
<frame src=test2.htm>
<frame src=test1.htm>
</frameset>
</html>


test1.htm:
appears in the bottom/visible frame and does the work
<HTML>
<script>
function Touched()
  {
  parent.frames[1].document.forms[0].submit();
  parent.frames[0].document.forms[0].submit();
  }
</script>
<BODY>
<!-- do the post that he does see -->
<form action=http://www.altavista.digital.com>
<input type=button value="Touch here to do double post" onClick=Touched()>
</form>
</body>
</html>

test2.htm:
Goes in the top frame and just allows for the other submit:
<HTML>
<BODY>
<form name=theForm action=http://www.yahoo.com/>
This form will be invisible since it is bigger than one pixel
<input type=submit >
</form>
</body>
</html>
0
 
LVL 8

Expert Comment

by:jhurst
ID: 2581421
the above will of course just do a pair of submissions that bring up the pages shown.  You need to replace the action with whatever you want.
0
 
LVL 8

Expert Comment

by:jhurst
ID: 2581550
By the way, in my test.htm I allow the top farem to be 100 so that you can see it.  It should be set as 1, so as not to show.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 1

Author Comment

by:mativare
ID: 2582213
Adjusted points to 200
0
 
LVL 1

Author Comment

by:mativare
ID: 2582214
Lets make sure we understand each other correctly
I have data input form lot of text boxes
I want to insert them into diferent systems
(Unix and NT)
Your explanation works 50% only
it posts test1.htm very good
now my test2.htm needs to post to x.asp
lets look inside x.asp in order to understand
it uses

y=request.Querystring("fieldfromtest1needed")

but nobody filled out y on test2.htm it is empty
because invisible

see it wants info written on test1.htm
nobody wrote things to test2.html
so your programs second part has nothing to
POST and it does nothing

I want to see y from test1.htm in order
to POST on test2.htm (across html files)
Global variables or something
Please supply workaround.


0
 
LVL 9

Expert Comment

by:TTom
ID: 2584103
I think you have two choices.  You can either create hidden varibles in one of your forms and, when the other is submitted, transfer your data (via JavaScript) to the fields on the other form before the submission, OR you can do a "sequential submit", making the response from the first form into a second form which submits itself as soon as it is loaded.

Hope this makes sense, as I am jumping in to the discussion a bit late.

Tom
0
 
LVL 8

Accepted Solution

by:
jhurst earned 200 total points
ID: 2584128
Just have the form on the hidden frame also and have your function copy the values from the one form that as filled in to the same values in the other one before doing the submit.

This like:
parent.frames[0].document.form[0].varable1.value=
  parent.frames[1].document.form[0].varable1.value;

etc.
0
 
LVL 1

Author Comment

by:mativare
ID: 2588510
Now I understand your idea clearly
java function now looks like
  function Touched()
                     {
parent.frames[0].document.form[0].contact_fname.value=parent.frames[1].document.form[1].contact_fname.value
                   parent.frames[1].document.forms[0].submit();
                    parent.frames[0].document.forms[0].submit();
                     }
where contact_fname is input name in visible frame
duplicate form is on invisible frame too now
first line of code gives me error(where I try contact_fname=contact_fname)
without this first line it works
please help to fix syntax
seems frames[1] is visible where data actually submitted.
my main form is
 <html>
                   <frameset rows=1,*>
                   <frame src=phantom.html>
                   <frame src=account_request.html>
                   </frameset>
                   </html>
0
 
LVL 8

Expert Comment

by:jhurst
ID: 2588644
First, this is Javascript not Java.  Second, I think that in your assignment you have form[1] instead of form[0].  Note the form is still the first form in that window, unless you actually have more than one form in that window.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This video teaches users how to migrate an existing Wordpress website to a new domain.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now