Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   javascript references becoming undefined when adding validators (http://www.velocityreviews.com/forums/t107888-javascript-references-becoming-undefined-when-adding-validators.html)

=?Utf-8?B?TWlsZXM=?= 08-11-2005 10:29 AM

javascript references becoming undefined when adding validators
 
I have an ASP.Net text box which I am adding a javascript event (onChange) at
runtime. It passes a parameter which is another control which I am getting
the name for from the ClientID property.

So when rendered looks like:

<input name="txtVal" type="text" id="txtVal" onChange="DoCalc(txtVal2);"/>

This works fine, but as soon as I add a rangeValidator to the txtVal2
control and the event fires it fails with a txtVal2 is undefined error?
Removing the validator recifies the problem.

Any help would be appreciated.

=?Utf-8?B?U3JlZWppdGggUmFt?= 08-11-2005 03:20 PM

RE: javascript references becoming undefined when adding validators
 

Not sure what could be this issue.. But have you tried
onChange="DoCalc(this);" ?

this will pass the reference of object making the function call...



"Miles" wrote:

> I have an ASP.Net text box which I am adding a javascript event (onChange) at
> runtime. It passes a parameter which is another control which I am getting
> the name for from the ClientID property.
>
> So when rendered looks like:
>
> <input name="txtVal" type="text" id="txtVal" onChange="DoCalc(txtVal2);"/>
>
> This works fine, but as soon as I add a rangeValidator to the txtVal2
> control and the event fires it fails with a txtVal2 is undefined error?
> Removing the validator recifies the problem.
>
> Any help would be appreciated.


=?Utf-8?B?TWlsZXM=?= 08-11-2005 03:25 PM

RE: javascript references becoming undefined when adding validator
 
Unfortunatley it needs to pass a different control to a function in a
javascript file file so even if this worked i wouldnt allow the desired
functionality.

"Sreejith Ram" wrote:

>
> Not sure what could be this issue.. But have you tried
> onChange="DoCalc(this);" ?
>
> this will pass the reference of object making the function call...
>
>
>
> "Miles" wrote:
>
> > I have an ASP.Net text box which I am adding a javascript event (onChange) at
> > runtime. It passes a parameter which is another control which I am getting
> > the name for from the ClientID property.
> >
> > So when rendered looks like:
> >
> > <input name="txtVal" type="text" id="txtVal" onChange="DoCalc(txtVal2);"/>
> >
> > This works fine, but as soon as I add a rangeValidator to the txtVal2
> > control and the event fires it fails with a txtVal2 is undefined error?
> > Removing the validator recifies the problem.
> >
> > Any help would be appreciated.


=?Utf-8?B?U3JlZWppdGggUmFt?= 08-11-2005 03:32 PM

RE: javascript references becoming undefined when adding validator
 
my mistake! .. didnt notice the control being passed is different..

"Miles" wrote:

> Unfortunatley it needs to pass a different control to a function in a
> javascript file file so even if this worked i wouldnt allow the desired
> functionality.
>
> "Sreejith Ram" wrote:
>
> >
> > Not sure what could be this issue.. But have you tried
> > onChange="DoCalc(this);" ?
> >
> > this will pass the reference of object making the function call...
> >
> >
> >
> > "Miles" wrote:
> >
> > > I have an ASP.Net text box which I am adding a javascript event (onChange) at
> > > runtime. It passes a parameter which is another control which I am getting
> > > the name for from the ClientID property.
> > >
> > > So when rendered looks like:
> > >
> > > <input name="txtVal" type="text" id="txtVal" onChange="DoCalc(txtVal2);"/>
> > >
> > > This works fine, but as soon as I add a rangeValidator to the txtVal2
> > > control and the event fires it fails with a txtVal2 is undefined error?
> > > Removing the validator recifies the problem.
> > >
> > > Any help would be appreciated.



All times are GMT. The time now is 06:07 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.