Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Reading javascript modified value from a readOnly TextBox [modified]

Reading javascript modified value from a readOnly TextBox [modified]

Scheduled Pinned Locked Moved ASP.NET
helpjavascriptquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SmartSpider
    wrote on last edited by
    #1

    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

    N 1 Reply Last reply
    0
    • S SmartSpider

      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

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      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

      S 1 Reply Last reply
      0
      • N Not Active

        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

        S Offline
        S Offline
        SmartSpider
        wrote on last edited by
        #3

        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 :-)

        N 1 Reply Last reply
        0
        • S SmartSpider

          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 :-)

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups