Requiredfield validator

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

  1. #1

    Default Re: Requiredfield validator

    Sean:

    I would use a CustomValidator for this. Using JavaScript its really easy to
    detect if the first item in the dropdown box is selected.

    Something like:

    function isFirstPicked()
    {
    if (document.formname.dropdownlistname.selectedIndex == 0)
    {
    return false;
    }
    }

    tie the function into your CustomValidator and you should be good to go.

    HTH
    --
    Elliot M. Rodriguez, MCSD
    *** It would take 227 cans of Mountain Dew to kill me***



    "Sean" <ssmith@yahoo.com> wrote in message
    news:OF3o%23k2VDHA.2168@TK2MSFTNGP09.phx.gbl...
    > Hi,
    >
    > I have 2 buttons A and B, textbox C and dropdown list D. When A is
    clicked,
    > C is required field. When B is clicked, C and D are required fields. There
    > is a dummy entry "please select" in the dropdown list. When B is clicked,
    D
    > can't be the dummy option.
    >
    > I wonder what is the best practice for this case? I was thinking to use
    > server-side validation for these controls, and created 2 RequiredField
    > Validators and set them TRUE at designer. Is there anybody who can
    enlighten
    > me? Thanks.
    >
    >
    >

    Elliot Rodriguez Guest

  2. Similar Questions and Discussions

    1. validator qs.(1.5)
      Hi, I have a field in the form for which I have to check that it should have some specific string e.g 1234. I tried using below it works if I...
    2. ANN: TMT Validator
      This is my latest toy. It's not strictly DW related (not yet at least), but it can be handy to people that build web applications:...
    3. CheckBoxList RequiredField Validator
      Hello All, I've been a taker of information from newsgroups for a long time and thought I'd finally make a contribution back to the community...
    4. Validator
      Hi, I have a little problem with me form validation. When i run my page on the "Localhost" everything work fine, but when i run the page on...
    5. Help: Requiredfield validator
      Hi, I have 2 buttons A and B, textbox C and dropdown list D. When A is clicked, C is required field. When B is clicked, C and D are required...
  3. #2

    Default Re: Requiredfield validator

    I got the idea. Thank you.

    "Elliot Rodriguez" <elliotmrodriguez@hotspammyspammail.com> wrote in message
    news:#uHaOb3VDHA.2248@TK2MSFTNGP10.phx.gbl...
    > Sean:
    >
    > I would use a CustomValidator for this. Using JavaScript its really easy
    to
    > detect if the first item in the dropdown box is selected.
    >
    > Something like:
    >
    > function isFirstPicked()
    > {
    > if (document.formname.dropdownlistname.selectedIndex == 0)
    > {
    > return false;
    > }
    > }
    >
    > tie the function into your CustomValidator and you should be good to go.
    >
    > HTH
    > --
    > Elliot M. Rodriguez, MCSD
    > *** It would take 227 cans of Mountain Dew to kill me***
    >
    >
    >
    > "Sean" <ssmith@yahoo.com> wrote in message
    > news:OF3o%23k2VDHA.2168@TK2MSFTNGP09.phx.gbl...
    > > Hi,
    > >
    > > I have 2 buttons A and B, textbox C and dropdown list D. When A is
    > clicked,
    > > C is required field. When B is clicked, C and D are required fields.
    There
    > > is a dummy entry "please select" in the dropdown list. When B is
    clicked,
    > D
    > > can't be the dummy option.
    > >
    > > I wonder what is the best practice for this case? I was thinking to use
    > > server-side validation for these controls, and created 2 RequiredField
    > > Validators and set them TRUE at designer. Is there anybody who can
    > enlighten
    > > me? Thanks.
    > >
    > >
    > >
    >
    >

    Sean 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