p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Javascript How-To (http://p2p.wrox.com/forumdisplay.php?f=87)
-   -   Posting problem with forms think JS is the answer? (http://p2p.wrox.com/showthread.php?t=26307)

busher March 2nd, 2005 04:17 PM

Posting problem with forms think JS is the answer?
 
I am having some issues with a form I am trying to build. Essentailly there are 3 parts to this form: Section A, Section B, and Section C.
Within Section A, if someone changes the date in a textbox, then, it need to be submitted back to the page to run the same query with a different date. The results populate Section B. Section C, changes with the change date in Section A, but it can also change with the date from and to in section B. Section C is a dynamically built table this checkboxes that an individual can select to be saved.
I then need a submit button to post all three sections to another page to be saved in the DB. I think I have a problem with my architecture, but here it is.

Section A is a form in and of itself with a onChange event for posting the new date back to the page.

Section B is also a form in and of itself which displays the query results form section A, but here is a catch, the user has to be able to edit any of the text boxes in section B. The user can then also change the from and to dates in section B to change the results of section C.

Section C is a third form which allows the user to select multiple options to be saved in the DB.

Thus, since nested forms is not an option, is there a way to capture the input changes in section B and pass them into the form of Section C so that all of them can be handled on another page accordingly???

I hope you are not as confused as I am!!! Thanks for the help!!!

ps. If anyone actually can respond to this you are SUCH A MAN/WOMAN! WOW!!!!!!

joefawcett March 3rd, 2005 04:46 AM

Should be straight forward. Are you trying to change section C based on section B without any information from B being posted back in between? So if you have a text box in B named "txtDataB" then you can update one in C named "txtDataC" by having an a handler for the onchange event in txtDataB:
Code:

<input type="text" name="txtDataB" onchange="updateFormC(this, 'txtDataC');">

function updateFormC(Sender, TargetName)
{
  var oTarget = document.forms[2].elements[TargetName];
  oTarget.value = Sender.value;
}

--

Joe (Microsoft MVP - XML)

busher March 3rd, 2005 12:36 PM

I think your solution may work, but let me TRY to make this more clear.

Section A (Form #1) is nothing but a date that controls Sections B & C (Forms #2, #3). When the date changes, the information in B & C change accordingly.

Section B (Form #2) is a series of text inputs that have a value returned from the recordset based on the date of Section A (Form #1). Section B (Form #2) also has 2 date text inputs in it (DateRangeFrom and DateRangeTo). These two change according to the date given in Section A (Form #1) and can be manually changed at the users descretion(sp?). If they are changed, then the information in Section C (Form #3) changes accordingly.

Section C is a table that has a series of checkboxes to allow the user to select a particular row to be saved in the database for future reporting or viewing.

All of the information from Section A, B, and C (Forms 1, 2, and 3)then needs to be sent to another page to be saved in various tables to be retrieved later. The problem is that the information changes in Section B are not being captured and sent when the form submit button is press because it is only posting Section C (Form #3) data.
I tried using hidden fields that contain the same data as Section B, but if the user changes the Section B data, it will not update the hidden fields in Section C.

vinod_yadav1919 March 4th, 2005 02:06 AM

Hii Busher!!

for --> "I tried using hidden fields that contain the same data as Section B, but if the user changes the Section B data, it will not update the hidden fields in Section C."


Write a javascript function that changes the value of hidden form fields on Section C,


Cheers :)

vinod


All times are GMT -4. The time now is 03:43 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.