Restricting user input

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • biga1
    New Member
    • Aug 2006
    • 1

    Restricting user input

    Strange question coming ...

    I need to be able to provide the user the ability to insert appropriate text (not free-form) at a point in a file.

    I was thinking of loading the file into a text area input. There would be an additional set of buttons for each of the pieces of text to be inserted. The user could navigate using their cursor within the text area to the point within the text area where text insertion is to occur. They would then press the appropriate button for that text to be inserted at the cursor.

    This raises some challenges! The text could easily be loaded and the entire field disabled, but how would the (presumably) Javascript then be able to insert text at the cursor point? Any help will be much appreciated.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    This thread should help.

    Comment

    • dlite922
      Recognized Expert Top Contributor
      • Dec 2007
      • 1586

      #3
      Originally posted by biga1
      Strange question coming ...

      I need to be able to provide the user the ability to insert appropriate text (not free-form) at a point in a file.

      I was thinking of loading the file into a text area input. There would be an additional set of buttons for each of the pieces of text to be inserted. The user could navigate using their cursor within the text area to the point within the text area where text insertion is to occur. They would then press the appropriate button for that text to be inserted at the cursor.

      This raises some challenges! The text could easily be loaded and the entire field disabled, but how would the (presumably) Javascript then be able to insert text at the cursor point? Any help will be much appreciated.
      There's a couple of ways to tackle this problem, assuming the position in the file is predefined

      You can just display the content as a text and display it. At the appropriate spot, insert a text area or text box for the user to make their additions. In your case its not free-form, so it could be a drop down box.

      You can then string it together server-side.

      Or try disabling the text area and insert the appropriate text there with javascript, it should let you even if disabled.

      Good luck,

      Dan

      Comment

      Working...