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

Set RadTextbox as Invalid programatically on client side

1 Answer 131 Views
Input
This is a migrated thread and some comments may be shown as answers.
Roberto Yudice
Top achievements
Rank 1
Roberto Yudice asked on 30 Aug 2010, 04:24 PM
Is there anyway to set a radtextbox as invalid so that it shows the warning icon using javascript?

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 31 Aug 2010, 09:21 AM
Hello Roberto,

Here is how to do it.

In order to remove the invalid state, you should set _invalid = false and call updateCssClass() again. This can be done in the RadTextBox' ValueChanged client handler or anywhere else.

<telerik:RadTextBox ID="RadTextBox1" runat="server" Text="RadTextBox" />
 
<asp:Button ID="Button1" runat="server" OnClientClick="return invalidate();" Text="click me" />
 
<script type="text/javascript">
     
function invalidate()
{
    var tb = $find("<%= RadTextBox1.ClientID %>");
    tb._invalid = true;
    tb.updateCssClass();
     
    return false;
}
     
</script>


Sincerely yours,
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
Input
Asked by
Roberto Yudice
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or