Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. ASP.NET

ASP.NET

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpcsharpasp-netsysadmin
1 Posts 1 Posters 7 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jamie Nordmeyer
    wrote on last edited by
    #1

    In my ASP+ page, I have three radio buttons for 'Vacaction', 'Paid Absence', and 'Other'. Next to the 'Other' radio button is a TextBox, where the user is supposed to specify what the 'Other' reason is for requesting time off. Following the TextBox, I have a CustomValidator WebControl that calls a ClientValidationFunction that, at this time, simply has the line 'alert("Hello");'. My problem is that right now, the function only gets called if I enter text in to the field. What I want to have happen is that anytime the 'Other' radio button is checked, if the TextBox is empty, then the validator should flag, and the error message should become visible. Here is the relevant code:

    <asp:radiobutton id="optVacation" text="Vacation" checked="true" groupname="AttendanceType" runat=server/>
    <asp:radiobutton id="optPaidAbsence" text="Paid Absence" groupname="AttendanceType" runat=server/>
    <asp:radiobutton id="optOther" text="Other (Specify)" groupname="AttendanceType" runat=server/>
    <asp:textbox id="txtOther" class="TextBox" width="300" runat=server/><asp:customvalidator id="OtherValidator" ClientValidationFunction="IsOtherFilled" ControlToValidate="txtOther" display="static" runat=server>Please specify Attendance (Other)</asp:customvalidator>

    And the function:

    function IsOtherFilled(source, value)
    {
    alert("Hello"); //This is only called if txtOther has text in it, but should be called regardless
    }

    Thanks in advance for any help that you may be able to provide. Jamie Nordmeyer Portland, Oregon, USA

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups