Re: Reference input without ID



<PRESENT321@xxxxxxxxx> wrote in message
news:1156990328.241043.191140@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a form that appears several times on a page, and would rather
not assign IDs.
Is there a way to have my validation function focus() a text input
without IDs?
www.osbornewood.com
Search form in the upper right corner.

Don't you mean upper left side?

"http://www.osbornewood.com"; has this Search Form:

<form action="http://www.osbornewood.com/search.cfm";
method="get" name="bar" id="bar" onSubmit="return searchSubmit();">
<input type="text" name="criteria" id=criteria size="7" value="Search"
style="color:grey;" onfocus="criteriaFocus(this);"
onblur="criteriaBlur(this);" />&nbsp;
<input type="submit" value="Go" />
</form>


which calls this function in "http://www.osbornewood.com/main.js":

function searchSubmit() {
if (document.getElementById) {
criteria = document.getElementById('criteria').value;
if (criteria == '' || criteria == 'Search') {
document.getElementById('criteria').focus();
return false;
} else {
return true;
}
}
}

Try changing it to:

function searchSubmit() {
var criteria = document.bar.criteria.value;
if (criteria == '' || criteria == 'Search') {
document.bar.criteria.focus();
return false;
} else {
return true;
}
}

Also, you can remove all "id=" from within the "form".


.



Relevant Pages

  • Re: A97 form blows up, #258
    ... I'm guessing you have a memory leak somewhere. ... after entering a bunch of IDs into the search form. ... combo boxes started asking for a parameter value in the data entry form ...
    (comp.databases.ms-access)
  • A97 form blows up, #258
    ... At the client site yesterday the user got a "too many databases open" after entering a bunch of IDs into the search form. ... Later that day, after entering a bunch more IDs, she got an out of memory error and the combo boxes started asking for a parameter value in the data entry form for the combo boxes. ...
    (comp.databases.ms-access)
  • Re: Reference input without ID
    ... not assign IDs. ... Is there a way to have my validation function focus() a text input ... Search form in the upper right corner. ...
    (comp.lang.javascript)
  • Reference input without ID
    ... not assign IDs. ... Is there a way to have my validation function focus() a text input ... Search form in the upper right corner. ...
    (comp.lang.javascript)