Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to modify form vairable in parent form ?

Status
Not open for further replies.

Jaheel22

Technical User
Joined
Jul 14, 2004
Messages
84
Location
US
Form A is submitted to call Form B.
While being in Form B, how can i modify the form fields in the Form A ? Please note i'm not using pop-up windows.

Form A
<form action="FormB" method="post" name=formA>
<input type=text name=HisAge value=33>
<input type=submit value=sumit>

Form B
<form name=formb>
// javascript to change HisAge to 22.
</form>


Thanks very much

 
parent.formname.elementname.value='blah';

or

opener.formname.elementname.value='blah';

that's in regards to the thread question, how to update the parent.

as for 2 forms in one page:

document.formB.elementname.value=document.formA.elementname.value;

[thumbsup2]DreX
aKa - Robert
 
Robert
parent.formname.elementname.value='blah';
It's not working. I get error that it's not object etc.
 
it's replacement code, you replace the names of things in it.... but to aid in the copy paste situation :

parent.formA.HisAge.value='666'; // this will ONLY work with parent/child window situations (more than one window, where one was opened by the other)

if you're using the code as you posted in your original thread, there is no parent/child situation, in that case you will need :

document.formA.HisAge.value='666';


[thumbsup2]DreX
aKa - Robert
 
supplimentary code, just in case you want to know how to make it the same as another box in formB versus making him 666 years old or blah every time :

document.formA.HisAge.value=document.formB.HisAge.value;

this will ONLY work if there's a field called "HisAge" in formB from what i see above, there's nothing in the formB for me to be able to supply you decent copyable code for it.

[thumbsup2]DreX
aKa - Robert
 
Robert

I replaced that code with my actual form name etc.
Again, it's not working.

Plz let me clearify again.
Form A was submitted to Form B.
Now Form B is the current web page while Form A is the previous. Is there any way to change/modify form A field's values ?

Thanks again for taking time and answering my question.

Mac
 
in THAT case it's the referring page, not the parent page.

to change formA's values, you would need to :

put another textbox in formB with the value desired from formA so it can be manually changed

press the back button and change/resubmit.

catch it after submit/onload of the second page (formB) and change the submitted value.

basically you're stuck with modifying the present, starting over ( back to the first form ), or banging around the value after you have it (second form)



[thumbsup2]DreX
aKa - Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top