Solved

two ACTIONs

Posted on 2000-03-02
12
205 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
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
 
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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jQuery UI datepicker: startDate / endDate - Stopping selectable dates based on day of the week 4 93
Adding a countdown to HTA 12 113
Saving Web Page as PDF 9 81
type of website 13 51
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

732 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