I have 40 or 50 inputs scattered among many pages that all need the
ability to open a popup which allows the user to navigate a file
directory structure, locate a specific file, and return the fully
qualified file name to the parent window input. All the 40 or 50 inputs
have unique IDs. Given any one input ID, I have everything working
perfectly: the parent form opens the popup using
window.open("FileFinder.aspx?dir=" + UserRootDirectory + "&InPutID=" +
IdCodeInOnClick);
Popup talks back to parent using window.opener.document...
Like I said, give me the input field ID and I can make everything work
every time... but it makes NO sense to write 40 or 50 functions, one
for each unique input field. I tried using
window.opener.document.forms[0].getElementByID(InPutID).value
but I keep getting an error message about something requiring an
object. Is there a way to accomplish this? Also, since I'm new to
JavaScript (and web programming generally), is there a good tool for
debugging JavaScript intended for IE?
Thanks.
Randy 5 3341
EoRaptor013 wrote: I have 40 or 50 inputs scattered among many pages that all need the ability to open a popup which allows the user to navigate a file directory structure, locate a specific file, and return the fully qualified file name to the parent window input. All the 40 or 50 inputs have unique IDs. Given any one input ID, I have everything working perfectly: the parent form opens the popup using window.open("FileFinder.aspx?dir=" + UserRootDirectory + "&InPutID=" + IdCodeInOnClick);
Popup talks back to parent using window.opener.document...
Like I said, give me the input field ID and I can make everything work every time... but it makes NO sense to write 40 or 50 functions, one for each unique input field. I tried using
window.opener.document.forms[0].getElementByID(InPutID).value
getElementById (note spelling) is a document method, it can't be used on
elements.
--
Ian Collins.
EoRaptor013 said the following on 5/3/2006 12:17 AM: I have 40 or 50 inputs scattered among many pages that all need the ability to open a popup which allows the user to navigate a file directory structure, locate a specific file, and return the fully qualified file name to the parent window input. All the 40 or 50 inputs have unique IDs. Given any one input ID, I have everything working perfectly: the parent form opens the popup using window.open("FileFinder.aspx?dir=" + UserRootDirectory + "&InPutID=" + IdCodeInOnClick);
Popup talks back to parent using window.opener.document...
Like I said, give me the input field ID and I can make everything work every time... but it makes NO sense to write 40 or 50 functions, one for each unique input field. I tried using
window.opener.document.forms[0].getElementByID(InPutID).value
window.opener.document.getElementById(InPutID).val ue
Or:
window.opener.document.forms.elements['elementName'].value;
forms don't have a getElementById (It is Id, not ID though).
but I keep getting an error message about something requiring an object.
Object expected? That is because it was hunting a getElementByID instead
of getElementById (even though forms don't have a gEBI)
Is there a way to accomplish this?
See above.
Also, since I'm new to JavaScript (and web programming generally), is there a good tool for debugging JavaScript intended for IE?
Experience reading those cryptic error messages. After you read about
the third million of them, they start making half sense. Use Firefox and
its JS Console and your learning curve will be a lot less bumpy.
Thanks. Randy
Makes me feel like I am talking to myself. As long as I don't answer
myself it's ok though :)
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Well, I'm still missing something. On the call to window.open I store
the return field ID in a hidden input on the child aspx. Then, on the
call back, I use:
var sRtnField = hfReturnField.value;
window.opener.document.forms.elements[sRtnField].value = "Client
Folders" + NewClientDir;
And here's the error message I get:
window.opener.document.forms.elements has no properties
Can you see what I'm doing wrong?
Thanks.
(When you talk to yourself it's called praying. When you answer
yourself it's called schizophrenia.)
Thanks to both Randy Webb and Ian Collins.
I tried using -- and properly capializing -- getElementById correctly
(always helps) and it worked! You folks just made my life SO much
easier.
Randy
EoRaptor013 said on 03/05/2006 3:09 PM AEST: Well, I'm still missing something. On the call to window.open I store the return field ID in a hidden input on the child aspx. Then, on the call back, I use:
var sRtnField = hfReturnField.value; window.opener.document.forms.elements[sRtnField].value = "Client Folders" + NewClientDir;
And here's the error message I get:
window.opener.document.forms.elements has no properties
"forms" is a collection, you have to specify *which* form, either using
its name or index in the forms collection. If you only have one form in
the page:
window.opener.document.forms[0].elements...
If you have multiple forms, it is better to use the form's name, say:
window.opener.document.forms['aForm'].elements...
If you have HTML like: <form name="aForm" ...>
--
Rob
Group FAQ: <URL:http://www.jibbering.com/FAQ> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Nevyn |
last post by:
Hi, having a class like the following
class node
{
int nodeID;
list<node> listOfChildren;
list<node> listOfParents;
}
what is the smartest/fastest way to find the nearest common parent...
|
by: ahaideb |
last post by:
I have a table (relation) in my database:
---------------
| parent | child |
---------------
| 1 | 2 |
| 1 | 3 |
| 2 | 4 |
| 2 | 5 ...
|
by: jalkadir |
last post by:
Let's say that I have this class:
class Parent{
private: char* str;
public: const char* getStr(){return str;}
};
And then I create a child class
class Child{
private: std::string str;...
|
by: Danny Tuppeny |
last post by:
Hi all,
I've been trying to write some classes, so when I have a parent-child
relationship, such as with Folders in my application, I don't have to
remember to add a parent reference, as well as...
|
by: Mitchel Haas |
last post by:
Hello,
Feeling a need for a generic tree container to supplement the available
containers in the STL,
I've created a generic tree container library (TCL). The library usage is
very much like...
|
by: HC |
last post by:
I've stripped down my code to barebones to demonstrate (below).
I have interfaces and classes which implement them. I force my generic
collection to accept only the interface type. If I create an...
|
by: mmurrell |
last post by:
I have a generic dictionary (lets call ChildCollection). I would like
to ensure that whenever a child is added to this collection
(SomeParent.Children.Add(new Child()), the parent of the child...
|
by: jewel87 |
last post by:
Hi everyone!
I'm writing some code in C under UNIX, which should give some output like this:
PARENT: pid = 10063
CHILD: my pid = 10064
CHILD: my parent's pid = 10063
CHILD: Sleeping...
PARENT:...
|
by: daokfella |
last post by:
I simply want to extend the List<Tobject to include a property
called VirtualCount. Basically, the list will hold my paged records,
but the VirtualCount property will tell me how many records total...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
| |