ClientValidationFunction function for a custom validator inside a repeater (ASPNET)

R

Radu

Hi,

I have a complicated page... including a repeater, an SqlDataSource
with FilterParameters, etc.

Anyway, on each row of the repeater I have, among others:

a combo-box named "cboLocations",
a textbox named "txtNewLocation"
and another textbox named "txtNewValue".

My idea is to allow the user to override any selection in cboLocations
by entering some text in txtNewLocation and a numeric value
corresponding to the new location in txtNewValue. I would like to have
a custom validator control checking the following:
*********
if the user entered something in txtNewLocation, then txtNewValue is
mandatory AND the text in txtNewValue should be numeric.
**********

If there is text in txtNewValue I could simply disregard it if there's
nothing in txtNewLocation.

I will write some VBNet function on the CustomValidator_ServerValidate
event.... On the client side, however, I would like to know how to
write the JavaScript function to accomplish the stated goals, above. I
have started by saying

function checkNewValue()
{
if (document.getElementById("txtNewLocation").value == "")
{

}
}

but the browser says "Error: Object required"..... Is it because
txtNewLocation is inside the repeater, and therefore cannot be found
???

I am a completely 'naive' in JavaScript, so please bear with me ! :))

Thank you VERY much
Alex.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top