ASP.NET Required field validators

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default ASP.NET Required field validators

    Hi

    How can I stop a requiredfield validator from validating?

    The scenario is that my page has 2 modes "Add" & "Edit"
    I have a single form on the page that either populates from the database if
    page is in edit mode or blank entries for adding a new record.

    When I am entering a new record I have 2 additional fields displayed on the
    form that are not required when editing the record, these 2 fields each have
    a validator attached to them.

    I have tried

    If Request.Params("mode") = "edit" then

    myValidator1.Visible = False
    myValidator1.Enabled = False
    myValidator1.IsValid = True

    End If

    and a combination of the three with no success, I still get the required
    field error message when submitting the form in edit mode

    Can anyone point me in the right direction please

    Many thanks



    ossie Guest

  2. Similar Questions and Discussions

    1. Web Form Required Field
      Not supported. For more form help see - http://www.publishermvps.com/Default.aspx?tabid=30 -- David Bartosik - MS MVP for Publisher help:...
    2. Required field validators do not while editing a row in a datagrid present in a composite control
      Hi All, I have created a composite control and I have added a datagrid in it. I am dynamically adding an edit column for editing the data. Now I...
    3. Detecting if a field is required
      Hi all, i need to detect whether a field is required or not. I'm using this code for building a string to convert later to an array (by Split) of...
    4. 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...
    5. Required field
      Newbie question: I have a reservation form and I want to make the email field, a required field. How do I go about doing this? Thanks! Reggie
  3. #2

    Default Re: ASP.NET Required field validators

    Might be that you need them to stop validating on the Client, in which case,
    try setting EnableClientScript to false.


    On 18/4/05 9:49 am, in article d3vs6h$qp8$1@forums.macromedia.com, "ossie"
    <ossie@microsoft.com> wrote:
    > Hi
    >
    > How can I stop a requiredfield validator from validating?
    >
    > The scenario is that my page has 2 modes "Add" & "Edit"
    > I have a single form on the page that either populates from the database if
    > page is in edit mode or blank entries for adding a new record.
    >
    > When I am entering a new record I have 2 additional fields displayed on the
    > form that are not required when editing the record, these 2 fields each have
    > a validator attached to them.
    >
    > I have tried
    >
    > If Request.Params("mode") = "edit" then
    >
    > myValidator1.Visible = False
    > myValidator1.Enabled = False
    > myValidator1.IsValid = True
    >
    > End If
    >
    > and a combination of the three with no success, I still get the required
    > field error message when submitting the form in edit mode
    >
    > Can anyone point me in the right direction please
    >
    > Many thanks
    >
    >
    >
    Calvin Willman Guest

  4. #3

    Default Re: ASP.NET Required field validators

    Assuming that you have separate buttons for the Add & Edit action then all
    you need to do is add the attritute CauseValidation=False to the update
    button.

    --
    Regards

    Paul Whitham
    Macromedia Certified Professional for Dreamweaver MX2004
    Valleybiz Internet Design
    [url]www.valleybiz.net[/url]

    Team Macromedia Volunteer for Ultradev/Dreamweaver MX
    [url]www.macromedia.com/support/forums/team_macromedia[/url]

    "ossie" <ossie@microsoft.com> wrote in message
    news:d3vs6h$qp8$1@forums.macromedia.com...
    > Hi
    >
    > How can I stop a requiredfield validator from validating?
    >
    > The scenario is that my page has 2 modes "Add" & "Edit"
    > I have a single form on the page that either populates from the database
    if
    > page is in edit mode or blank entries for adding a new record.
    >
    > When I am entering a new record I have 2 additional fields displayed on
    the
    > form that are not required when editing the record, these 2 fields each
    have
    > a validator attached to them.
    >
    > I have tried
    >
    > If Request.Params("mode") = "edit" then
    >
    > myValidator1.Visible = False
    > myValidator1.Enabled = False
    > myValidator1.IsValid = True
    >
    > End If
    >
    > and a combination of the three with no success, I still get the required
    > field error message when submitting the form in edit mode
    >
    > Can anyone point me in the right direction please
    >
    > Many thanks
    >
    >
    >

    Paul Whitham TMM Guest

  5. #4

    Default Re: ASP.NET Required field validators

    If i was you I would separate the Insert and Update into separate pages,
    that way you would not have to wory about it.

    --
    Kevin Marshall
    WebXeL.com Ltd
    [url]http://www.webxel.com[/url]

    ASP.NET Dreamweaver Extensions
    [url]http://www.webxel-dw.co.uk[/url]
    "ossie" <ossie@microsoft.com> wrote in message
    news:d3vs6h$qp8$1@forums.macromedia.com...
    > Hi
    >
    > How can I stop a requiredfield validator from validating?
    >
    > The scenario is that my page has 2 modes "Add" & "Edit"
    > I have a single form on the page that either populates from the database
    > if page is in edit mode or blank entries for adding a new record.
    >
    > When I am entering a new record I have 2 additional fields displayed on
    > the form that are not required when editing the record, these 2 fields
    > each have a validator attached to them.
    >
    > I have tried
    >
    > If Request.Params("mode") = "edit" then
    >
    > myValidator1.Visible = False
    > myValidator1.Enabled = False
    > myValidator1.IsValid = True
    >
    > End If
    >
    > and a combination of the three with no success, I still get the required
    > field error message when submitting the form in edit mode
    >
    > Can anyone point me in the right direction please
    >
    > Many thanks
    >
    >
    >

    Kevin Marshall Guest

  6. #5

    Default Re: ASP.NET Required field validators

    Or you could add the following to the tags of the optional validators:

    C#
    Enabled='<%# Request.Params["mode"] != "edit" %>'

    VB
    Enabled='<%# Request.Params("mode") <> "edit" %>'



    --
    Kevin Marshall
    WebXeL.com Ltd
    [url]http://www.webxel.com[/url]

    ASP.NET Dreamweaver Extensions
    [url]http://www.webxel-dw.co.uk[/url]
    "ossie" <ossie@microsoft.com> wrote in message
    news:d3vs6h$qp8$1@forums.macromedia.com...
    > Hi
    >
    > How can I stop a requiredfield validator from validating?
    >
    > The scenario is that my page has 2 modes "Add" & "Edit"
    > I have a single form on the page that either populates from the database
    > if page is in edit mode or blank entries for adding a new record.
    >
    > When I am entering a new record I have 2 additional fields displayed on
    > the form that are not required when editing the record, these 2 fields
    > each have a validator attached to them.
    >
    > I have tried
    >
    > If Request.Params("mode") = "edit" then
    >
    > myValidator1.Visible = False
    > myValidator1.Enabled = False
    > myValidator1.IsValid = True
    >
    > End If
    >
    > and a combination of the three with no success, I still get the required
    > field error message when submitting the form in edit mode
    >
    > Can anyone point me in the right direction please
    >
    > Many thanks
    >
    >
    >

    Kevin Marshall 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