Validators and javascript

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Validators and javascript

    How I can from client javascript know when one of my
    textboxes, Radio Button List, drop down box, etc...
    Validated to False when submitting the form.

    I can get the page_Isvalid==false but i need to know which
    control is empty or not selected, so i can put the
    cursor...

    //Sample code
    if (page_Isvalid==false){
    if (txt_box1.value.length<1){
    document.GetElementById('txt_box1').Focus()
    }
    }

    The code above works great but I don't now how to approach
    when i have a dropdownbox, radioButton list, etc...


    Thanks,
    dmedina
    dmedina Guest

  2. Similar Questions and Discussions

    1. Validators
      I gave up and just wrote my own validator to handle all my date validation. bill "J. Marcelo Barbieri" <mbarbieri@bf.com.br> wrote in message...
    2. Combo Box & Validators
      Hi, I am trying to validate a form in Flex. The form is made up of many text input boxes and combo boxes. I can validate the text inputs quite...
    3. postback doesn't work with validators.!
      I have a strange problem.. once I put any validators on my form, say a simple RequiredFieldValidator, then there is no postback happening. Even...
    4. Validators in version 1.1
      We have a technique for our order process whereby we simply turn panels on and off to capture data for the various stages, rather than the normal...
    5. how to enable the required validators in javascript
      Jenet: Specify in the OnSubmit event of your FORM element the name of the javascript function you want to call. <form method=post...
  3. #2

    Default Re: Validators and javascript

    The way I do the DropDownList boxes is I have the selected item say
    something like "make a selection" and it has a value of 0 (none of my other
    values have a 0 value.) that value is hardcoded as part of the list. Yes I
    did have to override the asp DropDownListBox to have this functionality, but
    you could also do it by hand.

    Then I step through it the same way you did with the TextBox except for the
    list box.

    if ( ddl_box1.value == "0" )
    document.GetElementById( 'ddl_box1').focus()

    HTH,

    bill

    "dmedina" <jayuya@cox.net> wrote in message
    news:258601c33f26$fe2a5480$a601280a@phx.gbl...
    > How I can from client javascript know when one of my
    > textboxes, Radio Button List, drop down box, etc...
    > Validated to False when submitting the form.
    >
    > I can get the page_Isvalid==false but i need to know which
    > control is empty or not selected, so i can put the
    > cursor...
    >
    > //Sample code
    > if (page_Isvalid==false){
    > if (txt_box1.value.length<1){
    > document.GetElementById('txt_box1').Focus()
    > }
    > }
    >
    > The code above works great but I don't now how to approach
    > when i have a dropdownbox, radioButton list, etc...
    >
    >
    > Thanks,
    > dmedina

    William F. Robertson, Jr. Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139