Forum Moderators: coopster

Message Too Old, No Replies

Multiple forms on a single page

Using one submit button clears all data from the other

         

russkern

12:58 am on May 23, 2008 (gmt 0)

10+ Year Member



Hi all,

I have a single page with multiple forms on it... one form calculates some quantities & totals and another retrieves data from a database based on a select list.

Problem is... I want to be able to view the data from both forms simultaneously...

problem is, if I submit the calculate form, it returns all my info, but then if I go select an account from the second form, and click That submit button, it clears all the data from the first form.

Hope I'm explaining this well enough... anyone have any suggestions to retain the "calculate" data after I submit the second form?

Thanks in advance...

Russ

Pico_Train

5:20 am on May 23, 2008 (gmt 0)

10+ Year Member



Yes, the first form depends on your first post and that disappears when you do a second different post.

You could create two divs. 1 holds the 1st form, the second div holds the second form, with different ids.

Then with AJAX, refresh the <div>s for each form submitted section by writing only to that <div>'s inner html.

[edited by: Pico_Train at 5:23 am (utc) on May 23, 2008]

russkern

10:36 am on May 23, 2008 (gmt 0)

10+ Year Member



OK... I sort of thought something like that... can you point me toward a tutorial for that... I'm not really all that familiar with AJAX. Could Javascript do the same thing?

Pico_Train

12:31 pm on May 23, 2008 (gmt 0)

10+ Year Member



yes, that's it.

Ummm as far as tutorials go, no I don't have any for you but I will send you some code through sticky mail... :-)

Pico_Train

12:48 pm on May 23, 2008 (gmt 0)

10+ Year Member



I reckon you could also just do it in iframes and include both in the right spot, but not sure how that would work out for you and it's up to you really.

coopster

12:56 am on May 24, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I'm not really all that familiar with AJAX. Could Javascript do the same thing?

AJAX is JavaScript. Here is a relative thread of interest:
[webmasterworld.com...]

russkern

10:16 am on May 24, 2008 (gmt 0)

10+ Year Member



Yeah... I realized that after the post...
I don't do a lot with Javascript beyond form validation so Everyones examples are helping a lot...

Thanks.

russkern

1:14 pm on May 24, 2008 (gmt 0)

10+ Year Member



thanks for the help everyone...
It looks tougher than it really is... once you understand what a lot of the Javascript is doing... Which I don't understand it all, but I'm figuring it out.

I have it all working just need to make tweaks and finish the other features of the page based on this info.

Russ