[thelist] Form sniffing within tables nested within divs
Chris Marsh
chris at webbtech.co.uk
Wed Nov 6 12:17:00 CST 2002
Josh
> Does each form have a name?
No, unfortunately not. Even if this was the case it wouldn't do me much
good as the page is built dynamically. Depending on the status of the
user *and* their position in the site there will be different forms
available in a given page.
> If so you can reference it
> directly, otherwise is there any defining charactaristing of
> the form such as a object name (textbox, etc.) that you could
> test for in JavaScript?
No, again. Plus, I can't exclude any other forms that I know are going
to be on the page, as the page will be changing over time (as well as
dynamically) so I can't hard code anything.
> Could you clarify what you are trying to do and what you will
> do once the form is referenced?
To illustrate what I'm trying to do, I'll show you what I would do if I
needed every form on the page:
function GetForms() {
var o = new Object;
var fo = document.forms;
var fl = of.length;
for(i=0;i<fl;i++) {
var eo = fo[i].elements;
var el = eo.length;
for(j=0;j<el;j++) {
if(eo[j].type.indexOf("submit") > -1) {
o.eo[j].value] = i;
}
}
}
return o;
}
Hopefully this would give me a set of name/key pairs of all the forms on
the page. In fact this is *exactly* what I want to do, but limit it to
any forms nested within a certain div, the id for which is set in
tablets of stone.
Hope this clarifies, and tia for your assistance.
Regards
Chris Marsh
More information about the thelist
mailing list