V9 - Changing form field attributes on the client side

Hello,

Is there a way to change the attributes of a field on a V9 form using a client side Jscript function?

 

A common functionality we need is to change if field is enabled or disabled based on a selection of a radio button.

Prior to v9, we could use "document.getElementById(elementName)" to get a handle on the form field and change it properties easily

But in V9 it returns an object. The object has "disabled" property but changing the property in a client side script function does not make field disabled on the form.

 

Please help and advise

 

Thanks & regards

Sandeep

 

 

Tagged:

Comments

  • Hi Sandeep,

     

    Since V9 uses Telerik's ASP.NET AJAX controls, you can try utilizing Telerik's client-side scripting API model in combination with Microsoft's ASP.NET AJAX client-side API to manipulate field properties and behaviors such as enabling / disabling fields.

     

    Examples:

     

    $find("Text1").editor.enable(); // enables the 'Text1' text field using client-side Javascript

    $find("Text1").editor.disable(); // disables the 'Text1' text field using client-side Javascript

     

    Hope this helps.

     

  • Hi Kalvin,

    Thanks a lot for the solution.

    I tried it and it works

    Regards

    Sandeep

  • Hi, 

     

    I tried the above solution, and my textbox seems to remain readonly.

     

    I tried with:

    $find("txtName").editor.enable();

     

    can attach an example?

     

    Thanks alot

     

     

  • Alright, 

     

    I got it works, I got confused with disable and readonly :P

    may I ask is there a way to change the attribute from readonly to optional?

     

    Thanks

     

  • Does

    $find("Text1").editor

    is universal way for accessing Telerik client-side objects of RadControls?

     

    It looks like it works for ComboBox fields ( $find("Combobox1").editor will give you access to RadComboBox ), but I wasn't able to to access client-side object of RadListBox

  • You start hacking the client, and you're going to have a bad time....