This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

access child elements in parent form

 
Rekha Pande
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have this parent form, in which i have a text box to enter the number of rows that are required in the child form, it goes like this

parent form : purchase form
Child Form : Item Form

IN PARENT FORM:
Enter the number of items purchased : 3 (User enters three) // Purchase Form

In the parent form, i have a frame in which the child form is displayed with three rows and each row has 3 text boxes. // Items Form

Now when i click the submit button in the parent form i.e. the purchase form, i want to check whether the textboxes that are their in the child form (item form)are empty or not.

Please can some one guide me on this...!!

Thanks.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can get to the values like this

You can run a function on the onsubmit of a form like this

For function:


Eric
 
Rekha Pande
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,

Thank you for your reply, I had tried your solution but with that i could access the parent elements from child but couldn't access the child elements from parent

So then i tried parent.framename.formname.elementname in the Parent form, and now it's working fine...!!!

Thank you so much...!!!
 
Rekha Pande
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And i really like this piece of code :
document.formName.elementName.style.backgroundColor="red";

I never knew this before... Thanks..!!!
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
parent.framename.document.formname.elementname

do not forget the document, certain browsers will not like the element reference without it.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic