• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

access child elements in parent form

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic