This is a migrated thread and some comments may be shown as answers.

TextBox Validation Issue

3 Answers 121 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 03 Mar 2010, 02:41 PM

1) How can you validate a textbox to look exactly as they do when using the input manager? 


This doesn't give me the same look that the input manager does:
<telerik:RadTextBox ID="txt_Make" Runat="server" Skin="Windows7"  
                        Width="170px"
                    </telerik:RadTextBox> 
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Required!" ControlToValidate="txt_Make" Display="Dynamic" SetFocusOnError="True"></asp:RequiredFieldValidator> 

I want them to look exactly like the inputmanager:
<telerik:RadInputManager ID="AppInputManager" runat="server" Skin="Windows7"
                  <telerik:TextBoxSetting ErrorMessage="Required!"
                      <TargetControls> 
                          <telerik:TargetInput ControlID="txt_FirstName" /> 
                          <telerik:TargetInput ControlID="txt_LastName" /> 
                          <telerik:TargetInput ControlID="txt_Address" /> 
                          <telerik:TargetInput ControlID="txt_City" /> 
                      </TargetControls> 
                    <Validation IsRequired="True" ValidationGroup="Application"></Validation> 
                  </telerik:TextBoxSetting> 
</telerik:RadInputManager> 




The input manager displays the icon and the message in red INSIDE the control, the validator does not.

I cant use an input manager for some of the fields because they are only required based on user input.  I tried adding an entire new input manager for these fields, but then they always try to get validated - even when hidden.  And I don't want to do a postback - I don't think I can enable and disable the input managers client-side.


3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 03 Mar 2010, 03:07 PM
Hi Shawn,

In order to display the native invalid state of a RadTextBox, you must use a custom validator. Here is a sample page:

http://www.telerik.com/ClientsFiles/085521_138077_input.zip

Best wishes,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Shawn
Top achievements
Rank 1
answered on 03 Mar 2010, 03:17 PM
Thanks Dimo, but this doesn't replicate the inputmanager error behavior.  How can I get the error message to appear INSIDE the textbox, just as the im does?
0
Dimo
Telerik team
answered on 04 Mar 2010, 09:59 AM
Hi Shawn,

Neither RadTextBox, nor the asp Validator is designed to work that way.

Theoretically, you can set the error message as a RadTextBox value (using the Javascript method, which sets the _invalid property) and it will appear inside the textbox, but the control will think this is a real value, not an error message.

Best wishes,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
Shawn
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Shawn
Top achievements
Rank 1
Share this question
or