Checking for input field 
Author Message
 Checking for input field

I have (or not) this input field in my ASP page:
<INPUT type="text" size=10 maxlength=10 id=txtTransAmount
name=txtTransAmount>

If it doesn't exist and I try to validate it the page fails.
How can I check for the existence if this field in javascript before
validating it?



Mon, 13 Sep 2004 00:16:47 GMT  
 Checking for input field
"Raymond D'Anjou"

Quote:
> I have (or not) this input field in my ASP page:
> <INPUT type="text" size=10 maxlength=10 id=txtTransAmount
> name=txtTransAmount>

> If it doesn't exist and I try to validate it the page fails.
> How can I check for the existence if this field in javascript before
> validating it?

if I understand the problem correctly you are trying to use server-side
JavaScript to validate the input field through asp

so your code probably looks something like this ...

<%
    ...
    if(Request.Form("txtTransAmount") == "test") return;
%>

to test for the existence of a form field in asp-jscript do something like
this ...
<%
    ...
    if(Request.Form("txtTransAmount").Count == 0)
   {
        // no input elements by that name exist
        return;
    }
    else
    {
        // use Request.Form("txtTransAmount")
    }
%>



Mon, 13 Sep 2004 00:29:25 GMT  
 Checking for input field
For client side:

function exists(thisID){
    return (document.getElementById(thisID))?true:false;

Quote:
}

Gerald


Quote:
> I have (or not) this input field in my ASP page:
> <INPUT type="text" size=10 maxlength=10 id=txtTransAmount
> name=txtTransAmount>

> If it doesn't exist and I try to validate it the page fails.
> How can I check for the existence if this field in javascript before
> validating it?



Wed, 22 Sep 2004 05:24:15 GMT  
 Checking for input field
Thanks.



Quote:
> For client side:

> function exists(thisID){
>     return (document.getElementById(thisID))?true:false;
> }

> Gerald



> > I have (or not) this input field in my ASP page:
> > <INPUT type="text" size=10 maxlength=10 id=txtTransAmount
> > name=txtTransAmount>

> > If it doesn't exist and I try to validate it the page fails.
> > How can I check for the existence if this field in javascript before
> > validating it?



Fri, 24 Sep 2004 20:11:52 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. check input field, only numbers accepted

2. Populating a input-field

3. ** Form input field in link **

4. Update text input fields in a child window - need help

5. simulate a rich text input field??

6. input field type "file"

7. Help: Cursor Position in Input Field

8. input mask for date field

9. Cross - Browser input field problems

10. Getting/setting character position in an input field

11. form input field initial value truncate after space

12. Displaying text/input field depending on checkbox value

 

 
Powered by phpBB® Forum Software