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

ReadOnly Field

3 Answers 64 Views
Input
This is a migrated thread and some comments may be shown as answers.
Raymond
Top achievements
Rank 1
Raymond asked on 29 Aug 2008, 05:03 PM
Is it possible to get the changed value of readonly numeric text box during javascript processing on postback?

3 Answers, 1 is accepted

Sort by
0
Missing User
answered on 01 Sep 2008, 09:15 AM
Hello Raymond,


Please find attached a sample web application that demonstrates the needed approach.

Kind regards,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Kennon McCaa
Top achievements
Rank 1
answered on 06 Oct 2009, 06:51 PM
I am experiencing this issue too. Whenever my page attempts to save the new values the user has entered in the non-readonly controls the codebehind never sees the new values although the FindControl method does find the control.

I tried what was suggested in the attachment (with some modification for my situation) but my JS code never executes "MADE IT 2". It does however say that it found the control and makes it to "MADE IT 1" but somehow errors out when executing this line:

input.updateCssClass();


Here's my full function:
 
function TstUpdateCss(p_ctrlClientId) {   
   var input = $get(p_ctrlClientId);   
 if (input == null) {   
 alert("NOT FOUND");   
 } else {   
  alert("FOUND");   
 }  
 
 alert("MADE IT 1");   
 input.updateCssClass();  
 alert("MADE IT 2");   
 return;  

In the example the following line was included:
    input._textBoxElement.readOnly = readOnly;

Which I changed to: 
    input._textBoxElement.readOnly = false;

But the line errored every time so I removed it.

In the interest of full disclosure, in my case I am calling the TstUpdateCss() function from the onChange event of the control.

Also, this problem only appears to happen when AJAX is running. Furhtermore, although my codebehind is executed my AJAX hourglass indicator that is displayed to the user spins endlessly.

Also, the control in question is located within a grid control's EditFormSettings.

I am using Telerik.Web.UI v 2009.2.701.35

Thanks for any help.

 

0
Tsvetoslav
Telerik team
answered on 09 Oct 2009, 10:42 AM
Hello Kennon,

You should be executing $find() instead $get() when getting hand of the input client component. The $get() method returns the dom element of the control, while $find() gets the client component to which the updateCssClass() belongs. It is no wonder that the execution never reaches the second alert as before that you are trying to execute a method which does not exist in the input.

I hope this information helps.

Regards,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Input
Asked by
Raymond
Top achievements
Rank 1
Answers by
Missing User
Kennon McCaa
Top achievements
Rank 1
Tsvetoslav
Telerik team
Share this question
or