[thelist] JAVASCRIPT: realtime update of input fields in a form

Chris W. Parker cparker at swatgear.com
Mon Jul 1 17:16:00 CDT 2002


hi.

i'm in the planning stages of a CMS right now, and after reading
someones post on modifying highlighted text with javascript on the list
today, gave me an idea. i know this much about javascript... var i = 5;
and that's it.

i'd like to know how best to handle the "previewing" of the content
input in a multi-row textbox. or any input for that matter. the initial
"good" idea i had was to in realtime display the interpreted contents of
what the user was typing. the way it would work i guess would be to have
a text area, and directly below that have a preview area which was not a
part of the form. i know you can do this with form fields but i don't
know about regular html. i.e. with currency conversion you can have in
realtime the converted amount appear in a box as you type the original
amount in a nother box.

here is what my pseudo-code would look like... (very pseudo)

<form>
<table>
 <tr>
  <td><input name="content"></td>
 </tr>
 <tr>
  <td><script>javascript:document.write(input.content)</script></td>
 </tr>
</table>
</form>

so as the user types (and modifies their text with the highlighting
thing i spoke about earlier) the preview version will be shown below the
input box.

the reason i would like to do it this way is because it would be cool,
and by cool i mean totally sweet. and i also really hate clicking
"preview" buttons on other websites so that i can wait for another page
to load to show me what my input will look like. and i also think it
would make it easier for the user, for the same reason i said that i
don't like clicking preview buttons.

what do /you/ think?


thanks for all the help!

chris.




More information about the thelist mailing list