Link to home
Start Free TrialLog in
Avatar of dyachimiak
dyachimiak

asked on

unescape() textarea field flashes escape character (%20..etc. ) before showing normal text.

On my HTML page, I am allowing the user to enter a 1000 character text area field.
On Submit,  I use the escape() method on the field because the data is being sent to the AS400. When returning to the page, I use an unescape() method in my onLoad function. The problem is that I get a flash of the escape characters before the noraml text appears in the textarea box. Is there anyway to prevent to this?
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

The flash (or the visual representation) occures because you canvert the textarea value on some button click event.
To avoid that visual effects move the escape() statement from onClick event handler to form tag onSubmit event handler call.

Avatar of dyachimiak
dyachimiak

ASKER

My onClick event actually calls a function that does the escape, sets cookies for the AS400 to know the input and output program and html page, and then does the submit. All my submits are done in the events. Can I create a hidden field that can handle 1000 characters?
The onSubmit worked on the Form tag, but where do I unescape the text? I am now crashing while doing it in the OnLoad function.
Is it giving any problem if you use hidden field?
Before I use a hidden field, I need to know if I can create a hidden field that is 1000 characters in size.
I assume I can only create a hidden field with the input tag?
I dont think there is size limit on hidden field. So try it.
Form fields, hidden or not hidden, do not have a transfer limit on browser side.
Only limit that I know is for input fields of type file that do have limits how much data does the web server accept. But that are most above four megabytes, perhaps ten megabytes set in the web server config.

ASKER CERTIFIED SOLUTION
Avatar of AngryBinary
AngryBinary

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Actually, <textarea> tags can be hidden, too.  Either:

<TEXTAREA NAME="comments" COLS=40 ROWS=6 style="display:none;"></TEXTAREA>

or in your CSS:

<style>
     TEXTAREA { display:none; }
</style>
Indeed, the textarea alone could be hidden. However, some may find that a suddenly appearing text box is a bit more confusing than were an entire page to appear after loading, or a visibly dilineated segment were to pop into place.

Also, if you are showing/hiding a piece of the page rather than the entire page, it may be cleaner to use 'visibility:hidden' style instead, as the element will not be invisible but space will be maintained on the page. Jumping from 'display:none' to 'display:block' or 'display:inline' could cause the rest of the page to shift, which is also visually distracting.