Client Side Validation in a nested user control

Discussion in 'ASP .Net Web Controls' started by kurtzilla, Sep 22, 2004.

  1. kurtzilla

    kurtzilla Guest

    I am having a problem getting my client side validation function to
    work properly.

    The container page has a validation summary and several text boxes to
    capture user input such as firat and last names, address, etc. It also
    contains a user control which handles 4 textboxes used to capture the
    phone number only (the 4th is for an extension). This user control has
    a custom validator which checks for valid input.

    When the phone control is the only control that will not validate - it
    fills in the validation summary correctly, as well as displaying the
    text value (in this case an asterik) correctly.
    However, when a control on the container page is invalid and the phone
    control is invalid, only the error message for the container page's
    control shows up in the summary. The text value for the user control
    shows up, but the error message is not displayed.

    What about the nesting is keeping the summary from showing both
    messages?

    I realize I may have left out some pertinent details - but just hoping
    someone has run into this problem before. Please feel free to ask for
    whatever info may help.

    Here is the client validator function:
    (the getElementByLikeId function is similar to getElementById but gets
    around the problem of nested control names such as
    "ctl0__ctl0__TextInputControl")

    function ValidatePhoneDisplayControl(source, args) {

    if((args.Value.length < 4) ||
    (getElementByLikeId(source.document.forms[0],
    "TextPhone2").value.length < 3) ||
    (getElementByLikeId(source.document.forms[0],
    "TextPhone1").value.length < 3)) {

    args.IsValid = false;
    }

    args.IsValid = true;
    }
    kurtzilla, Sep 22, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    14
    Views:
    4,093
    Chad Z. Hower aka Kudzu
    Jan 30, 2004
  2. =?Utf-8?B?dmlkeWE=?=
    Replies:
    1
    Views:
    748
    Kevin Spencer
    Jun 2, 2005
  3. =?Utf-8?B?RGF2aWQgRGF2aXM=?=

    Client-side validation on user control

    =?Utf-8?B?RGF2aWQgRGF2aXM=?=, May 10, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    8,282
    Parag
    May 11, 2006
  4. Boss302
    Replies:
    0
    Views:
    1,035
    Boss302
    Nov 21, 2006
  5. Bogdan
    Replies:
    2
    Views:
    644
    Bogdan
    Jun 9, 2008
Loading...

Share This Page