Forum Moderators: open

Message Too Old, No Replies

Submitting 2 forms with one click

         

paratge

4:53 pm on Apr 16, 2007 (gmt 0)

10+ Year Member



Hi everyone,

I would appreciate your help on my problem :

I need to submit two forms with one button.

The web site i'm developing allows merchants to order parts and others things else and in function of their activity, the right supplier form page is loaded in an iframe. Submitting the fist form must send twice the two forms, but i get an error : permission denied to get Window.submit property.

Is there a way to fix this?

Thanks in advance.

Dabrowski

5:11 pm on Apr 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not in the way I think you're trying to access it.

I'm assuming the second form you want to submit is in the IFRAME on the supplier site, you cannot access any javascript or other objects in a different domain, hence your permission denied.

The only thing you could do is change the IFRAME src, and use the URL to pass the form data. Your suppliers form may use this method on their form submission anyway, in which case you could mimic the effect.

JAB Creations

5:15 pm on Apr 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Perhaps you could split the submit at the server?

- John

Fotiman

7:36 pm on Apr 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Right, the best solution to this would be to handle the split at the server. You can't really submit 2 forms at once using pure HTML. You could use JavaScript to do some trickery, but then anyone who had JavaScript disabled would not be able to submit both forms.

The best solution would be to split the form on the server instead of trying to put it into two forms on the page.

Dabrowski

8:36 pm on Apr 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That would be the best way, however I think that the server side script on the suppliers website would be out of paratge's jurisdiction.

Assuming he's running some sort of portal, I doubt he'd be allowed access to change their code.

Please let us know paratge so we can give you the best advice.

Fotiman

9:06 pm on Apr 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I didn't get the impression that the supplier's page was a 3rd party page. But if that's the case, it certainly does complicate the matter to some degree.

capulet_x

4:07 am on Apr 17, 2007 (gmt 0)

10+ Year Member



What type of info is in the forms? Is it sensitive like payment info? If it ISN'T sensitive a crude way would be to have your first form either hold the values in cookies temporarily to post to a dublicate form with all of the fields including the submit button hidden (you can use javascript to auto submit the second "hidden" form) OR if you are using some PHP and your second, "hidden", form is modified to accept GET variables you can create a URL string kind've like:

whatever.php?name=ONE&demo=TWO&blah=THREE
or
'www.example.com?name=' myName "$_POST['name']

and pass the dublicate variables through a URL to your "hidden" form.

If everything works right your user may see a slight flicker as the first form post then redirects to the second "hidden" form which automatically submits its dublicate values to wherever you want them posted at which point it could redirect to a Thank you page or something.

Very crude, yes.

There are much more elegant ways I'm sure.

But it can work.

paratge

7:12 am on Apr 17, 2007 (gmt 0)

10+ Year Member



In fact, there are no sensitive data.
The problem comes that order forms of suppliers web sites are different and built in different languages, so if they allow us to fill their forms in an hidden iframe they don't want to modify their web sites (it's the first thing i asked them...)

Thus, i have a function which duplicate data from one field to another hidden field in function of supplier website.

capulet_x

3:56 pm on Apr 17, 2007 (gmt 0)

10+ Year Member



paratge,

Do a Goggle search for formfiller javascript some of the info out there may help get the wheels turning.

Dabrowski

4:15 pm on Apr 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A goggle search eh? Didn't think of that one.

paratge, let me state an example and tell me if I'm right....

Your page on www.mydomain.co.uk has a form, for e.g. name, address, phone....
Your page then IFRAME's to www.supplier.co.uk who has a form name, address, phone, etc...
What you're trying to do is make the customer fill in the form on your site and post that to the supplier site?
So you're trying to get your submit function to 'press' the submit button on the supplier site?

Assuming that's right, how have you got the data across to the suppliers form?

paratge

5:58 pm on Apr 18, 2007 (gmt 0)

10+ Year Member



Yes,

With a little difference, I'm keeping data on my web site and sending them also to the supplier. It's not only to forbid user to know who is supplier, but to control suppliers pay-back.

Thus i need to submit 2 forms in a one click

paratge

6:01 pm on Apr 18, 2007 (gmt 0)

10+ Year Member



Sorry i forgot your last question.

I have a function fulling right fields in supplier form function of who he is. there are 21 suppliers and so, 21 different forms with different named fields.

So my function manage to complete the right field in function of supplier activity

Dabrowski

6:53 pm on Apr 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you mean you have a form for each supplier on your site? The impression I got was that you were filling the form in the supplier's IFRAME? If so, how are you doing this?

paratge

7:16 pm on Apr 18, 2007 (gmt 0)

10+ Year Member



No, it's not exactly like that :
merchants full fields in our web site form. For each field completed, a function duplicate data in corresponding supplier form field :
e.g. my field name is reference for one supplier it will be ref, for another idproduct, and so on. So a function knows for each supplier at what field corresponds reference and duplicate data in right field

Dabrowski

12:09 pm on Apr 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ok, so the customer is filling a search form on yoyr site, and you want your IFRAME to display your suppliers search results?