Hi,
I am new to asp.net and unfortunately, have to learn as I go.
Here is a "problem".
I have got two radio buttons No and Yes and text box that has to be fiiled
in only if Yes is clicked. How can I validate this?
Here is a code:
<asp:radiobutto nlist RepeatDirection =Horizontal RepeatLayout=Ta ble
id="is_override " runat="server">
<asp:listitem text="No" Value="0"></asp:listitem>
<asp:listitem text="Yes" Value="1"></asp:listitem>
</asp:radiobutton list>
<asp:requiredfi eldvalidator
id="RequiredFie ldValidator_is_ override"
runat="server"
ErrorMessage="Y ou must choose a valid Override option."
ControlToValida te="is_override ">
</asp:requiredfie ldvalidator>
<asp:textbox size=50 MaxLength="100" id="reason" runat="server" Text="" />
<!--- here I need some type of validation if a user cliked Yes --->
Help is very much appreciated!
Thanks 4 1432
Also, I am using VB
"News" <ge**@mailcity. com> wrote in message
news:y9******** ************@ma gma.ca... Hi, I am new to asp.net and unfortunately, have to learn as I go. Here is a "problem".
I have got two radio buttons No and Yes and text box that has to be fiiled in only if Yes is clicked. How can I validate this?
Here is a code:
<asp:radiobutto nlist RepeatDirection =Horizontal RepeatLayout=Ta ble id="is_override " runat="server"> <asp:listitem text="No" Value="0"></asp:listitem> <asp:listitem text="Yes" Value="1"></asp:listitem> </asp:radiobutton list> <asp:requiredfi eldvalidator id="RequiredFie ldValidator_is_ override" runat="server" ErrorMessage="Y ou must choose a valid Override option." ControlToValida te="is_override "> </asp:requiredfie ldvalidator>
<asp:textbox size=50 MaxLength="100" id="reason" runat="server" Text="" /> <!--- here I need some type of validation if a user cliked Yes --->
Help is very much appreciated!
Thanks
Can you do something like this:
1. Add a button.
2. Add this code:
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
If is_override.Sel ectedValue = 1 And reason.Text = "" Then
Response.Write( "You must enter a reason!")
Else
' do whatever (redirect, etc...)
End If
End Sub
"News" <ge**@mailcity. com> wrote in message
news:Gf******** ************@ma gma.ca... Also, I am using VB
"News" <ge**@mailcity. com> wrote in message news:y9******** ************@ma gma.ca... Hi, I am new to asp.net and unfortunately, have to learn as I go. Here is a "problem".
I have got two radio buttons No and Yes and text box that has to be
fiiled in only if Yes is clicked. How can I validate this?
Here is a code:
<asp:radiobutto nlist RepeatDirection =Horizontal RepeatLayout=Ta ble id="is_override " runat="server"> <asp:listitem text="No" Value="0"></asp:listitem> <asp:listitem text="Yes" Value="1"></asp:listitem> </asp:radiobutton list> <asp:requiredfi eldvalidator id="RequiredFie ldValidator_is_ override" runat="server" ErrorMessage="Y ou must choose a valid Override option." ControlToValida te="is_override "> </asp:requiredfie ldvalidator>
<asp:textbox size=50 MaxLength="100" id="reason" runat="server" Text=""
/> <!--- here I need some type of validation if a user cliked Yes --->
Help is very much appreciated!
Thanks
None of the Microsoft validators have the ability to turn themselves on
based on another element of the page. There are two solutions.
1. Write a custom validator. If you want it to work on the client side, you
will have to figure out that code too.
2. I have written a replacement for Microsoft's validation, "Profession al
Validation And More" ( http://www.peterblum.com/vam/home.aspx). Each of its
validators has a new property, "Enabler", where you can define a rule that
smartly enables the validator. On my RequiredTextVal idator, you can set the
Enabler to look at the radiobutton before enabling itself. This works fully
on the client-side. In fact, Professional Validation And More's 22
validators support many more browsers on the client-side than Microsoft: IE,
IE/Mac, Netscape/Mozilla, Opera 7 and Safari.
--- Peter Blum www.PeterBlum.com
Email: PL****@PeterBlu m.com
Creator of "Profession al Validation And More" at http://www.peterblum.com/vam/home.aspx
"News" <ge**@mailcity. com> wrote in message
news:y9******** ************@ma gma.ca... Hi, I am new to asp.net and unfortunately, have to learn as I go. Here is a "problem".
I have got two radio buttons No and Yes and text box that has to be fiiled in only if Yes is clicked. How can I validate this?
Here is a code:
<asp:radiobutto nlist RepeatDirection =Horizontal RepeatLayout=Ta ble id="is_override " runat="server"> <asp:listitem text="No" Value="0"></asp:listitem> <asp:listitem text="Yes" Value="1"></asp:listitem> </asp:radiobutton list> <asp:requiredfi eldvalidator id="RequiredFie ldValidator_is_ override" runat="server" ErrorMessage="Y ou must choose a valid Override option." ControlToValida te="is_override "> </asp:requiredfie ldvalidator>
<asp:textbox size=50 MaxLength="100" id="reason" runat="server" Text="" /> <!--- here I need some type of validation if a user cliked Yes --->
Help is very much appreciated!
Thanks
None of the Microsoft validators have the ability to turn themselves on
based on another element of the page. There are two solutions.
1. Write a custom validator. If you want it to work on the client side, you
will have to figure out that code too.
2. I have written a replacement for Microsoft's validation, "Profession al
Validation And More" ( http://www.peterblum.com/vam/home.aspx). Each of its
validators has a new property, "Enabler", where you can define a rule that
smartly enables the validator. On my RequiredTextVal idator, you can set the
Enabler to look at the radiobutton before enabling itself. This works fully
on the client-side. In fact, Professional Validation And More's 22
validators support many more browsers on the client-side than Microsoft: IE,
IE/Mac, Netscape/Mozilla, Opera 7 and Safari.
--- Peter Blum www.PeterBlum.com
Email: PL****@PeterBlu m.com
Creator of "Profession al Validation And More" at http://www.peterblum.com/vam/home.aspx
"News" <ge**@mailcity. com> wrote in message
news:y9******** ************@ma gma.ca... Hi, I am new to asp.net and unfortunately, have to learn as I go. Here is a "problem".
I have got two radio buttons No and Yes and text box that has to be fiiled in only if Yes is clicked. How can I validate this?
Here is a code:
<asp:radiobutto nlist RepeatDirection =Horizontal RepeatLayout=Ta ble id="is_override " runat="server"> <asp:listitem text="No" Value="0"></asp:listitem> <asp:listitem text="Yes" Value="1"></asp:listitem> </asp:radiobutton list> <asp:requiredfi eldvalidator id="RequiredFie ldValidator_is_ override" runat="server" ErrorMessage="Y ou must choose a valid Override option." ControlToValida te="is_override "> </asp:requiredfie ldvalidator>
<asp:textbox size=50 MaxLength="100" id="reason" runat="server" Text="" /> <!--- here I need some type of validation if a user cliked Yes --->
Help is very much appreciated!
Thanks
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Shabam |
last post by:
I know that dotnet allows for form field validation. However I'm looking to
customize the error message display and am wondering if it's possible to do
what I need.
Example:
Suppose in a form there is a "Name" field (required). The user leaves it
blank and submits the form. I need to reload the page with the "Name" in
red so the user can see which field(s) have errors in them.
|
by: Doslil |
last post by:
I am trying to validate the fields in my database.I have already
validated the fields to check for not null.Here is what I have written
for Numeric and text field.
Private Function EENUM()
On Error GoTo EENUMErr
If IsNull(Me.EmployeesID) Or Me.EmployeesID = "" Or Me.EmployeesID
< 0 Then
MsgBox "Employee Number Cannot Be Left Blank", vbOKOnly,
"Employee Number"
|
by: Joey P |
last post by:
Hi all,
I am doing a project for university whereby i have to implement a
simple database related to a frozen foods company. I am having some
trouble though creating a validation rule for one of my fields. I
have a table called "Product" and two of the fields included in this
table are "Cost Price" and "Retail Price". I need to create a
validation rule so that the Cost Price is always less than the Retail
Price. I have tried...
|
by: Rick |
last post by:
I have an interesting problem when I run the following
code in Netscape (7.02) vs. IE. This page works great in
IE and all my controls bring up the validation summary
dialog box if the required field is not filled out.
However in Netscape NONE of the required field
validations occurs at all in Netscape. The form is
posting correctly because I can walk through the post
back process. Any ideas why this is happening or how to
fix it?
|
by: Paul |
last post by:
I am trying to setup a field validator and tried using the control to validate set to a dropdown list box but did not seem to work. Is there anyway to set this up or do you need to use client side validation? Thanks
--
Paul G
Software engineer.
| |
by: Kivak Wolf |
last post by:
Hi,
Could someone give me a quick review of how to use the required field
Validator? I'm completely at a loss, and MSDN does not help one bit. =/
Basically all I want done is to make sure that the user enters some
text into a field called "txbName" and when they click on the submit
button, if they have not entered anything into the field, a Required
Field Validator will say "Invalid Name".
Thanks,
|
by: Niclas |
last post by:
Hi,
How do I indicate what field fails a validation, usually you see a red star
next to the faild field on a form. Is this built in functionality in the
valdaition controls or shall I code this myself ?
Niclas
|
by: AECL_DEV |
last post by:
Hello Everyone,
Ive seen alot of people saying that the best way to AJAX Validate a form is
through the submit button, because validation should be synchronous. Im
wondering, is there any good way to validate a form field by field like AJAX
would do, but to keep it synchronous? i.e. one action, one validation.
Thanks,
|
by: sellcraig |
last post by:
Microsoft access
2 tables
table "data main" contains a field called "code"
table "ddw1" is created from a make table query of "data main"
Goal-
the data in "code" field in needs to be inserted into a standard web
address in the table (the filed name is link) in ddw1
Example address ---
|
by: gweasel |
last post by:
What is the best way to apply a Validation Rule - or rather, where is
the best place to put it? Is there an advantage to putting it on the
field in the table vs setting the validation rule on the form the
control is on?
Basically I have a number of controls in a form that are required, and
to check it I am setting the Validation Rule to "<>"IsNull" so that
when the user tries to tab through/click out of a required area
without entering...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |