Reading javascript modified value from a readOnly TextBox [modified]
-
The page that I am working on displays a set of readonly text boxes with databound values. The user may enter edit mode [achieved through javascript: TxtBox.removeAttribute("readOnly")], modify the value, then exit edit mode [again javascript: TxtBox.setAttribute("readOnly", "true")]. Now when this form is posted back, I want to read the modified value of the text boxes, but all I get is the original values. One possible way for me to do this is put an input type="hidden" corresponding to each texbox being displayed and then, set it's value when the user exits the edit mode of the textbox. This way, when the page is posted back, I can read the value of these hidden fields, instead of actual textboxes. But I don't think this is the right way - unnecessarily increasing the page size, because at times, there could be 100s of textboxes. Is there another workaround? I am sure this is a common problem - I found many post, but no real solution. Any help is greatly appreciated. Thanks, R
modified on Saturday, January 24, 2009 4:28 PM
-
The page that I am working on displays a set of readonly text boxes with databound values. The user may enter edit mode [achieved through javascript: TxtBox.removeAttribute("readOnly")], modify the value, then exit edit mode [again javascript: TxtBox.setAttribute("readOnly", "true")]. Now when this form is posted back, I want to read the modified value of the text boxes, but all I get is the original values. One possible way for me to do this is put an input type="hidden" corresponding to each texbox being displayed and then, set it's value when the user exits the edit mode of the textbox. This way, when the page is posted back, I can read the value of these hidden fields, instead of actual textboxes. But I don't think this is the right way - unnecessarily increasing the page size, because at times, there could be 100s of textboxes. Is there another workaround? I am sure this is a common problem - I found many post, but no real solution. Any help is greatly appreciated. Thanks, R
modified on Saturday, January 24, 2009 4:28 PM
SmartSpider wrote:
Is there another workaround?
No, there is no workaround, there is, however, a way to use the controls correctly. Handle the TextChange event so you will get the updated value.
SmartSpider wrote:
there could be 100s of textboxes.
You should rethink your UI design in this case.
only two letters away from being an asset
-
SmartSpider wrote:
Is there another workaround?
No, there is no workaround, there is, however, a way to use the controls correctly. Handle the TextChange event so you will get the updated value.
SmartSpider wrote:
there could be 100s of textboxes.
You should rethink your UI design in this case.
only two letters away from being an asset
Use controls correctly - meaning postback my page on every text change??? Are you serious? And no, I'm not using Ajax... don't wanna go into details of why. 100s textboxes - my bad - that's a typo - 10s textboxes... It's a questionnaire, each question has a prepopulated text box against it. Thanks anyway :-)
-
Use controls correctly - meaning postback my page on every text change??? Are you serious? And no, I'm not using Ajax... don't wanna go into details of why. 100s textboxes - my bad - that's a typo - 10s textboxes... It's a questionnaire, each question has a prepopulated text box against it. Thanks anyway :-)
SmartSpider wrote:
Use controls correctly -
You still don't seem to understand this. :sigh: Unless the AutoPostback property is true the TextChangeEvent will not fire until a postback is triggered, such clicking a button. Since you seem to not understand the processes involved in ASP.NET I would suggest you take some time to read up on the subject before proceeding with your project.
SmartSpider wrote:
And no, I'm not using Ajax
Then you are limiting yourself and reducing the overall user experience, IMO
only two letters away from being an asset