Solved

two ACTIONs

Posted on 2000-03-02
12
200 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

759 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

18 Experts available now in Live!

Get 1:1 Help Now