?
Solved

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

Posted on 2007-03-30
10
Medium Priority
?
1,348 Views
Last Modified: 2008-01-09
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?
0
Comment
Question by:dyachimiak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
10 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 18823141
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.

0
 

Author Comment

by:dyachimiak
ID: 18823276
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?
0
 

Author Comment

by:dyachimiak
ID: 18823464
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.
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 11

Expert Comment

by:Manish
ID: 18823790
Is it giving any problem if you use hidden field?
0
 

Author Comment

by:dyachimiak
ID: 18823845
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?
0
 
LVL 11

Expert Comment

by:Manish
ID: 18824127
I dont think there is size limit on hidden field. So try it.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 18824763
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.

0
 
LVL 13

Accepted Solution

by:
AngryBinary earned 2000 total points
ID: 18826547
How is the textarea being populated with the escaped string? I imagine it would have to be assigned via either the scipt that generates the page (PHP, ASP, etc), or populated with javascript, since a static HTML page does not retain data after posting to a form.

If the text is being pushed into the text area via a server side script (as is most likely the case), then what is happening is the server is sending you the HTML page (escaped text and all), and your browser is waiting until the page has completed loading before firing the OnLoad event and transforming the text in the textarea. Essentially, you cannot prevent that little lag before the OnLoad event using your current method.

The behavior you should be shooting for is to transform the text on the server side, and have it served up unescaped by tweaking the back end script.

If that is not an option, then you can do some working around with javascript. Some designers like to style certain tags on a page as invisible by default (for instance, a DIV or even the entire BODY tag), and then in the OnLoad event make them visible by altering the style properties. This gives the impression that the entire page loads all at once (the drawback is if it takes a long time the user gets a little antsy and thinks the page isn't loading; a 'loading' message can be useful). If you were to make either your page or even just your textarea invisible via stylesheet, you can turn on the visibility of the hidden element once the appropriate transformations have been made in the OnLoad event and prevent that little page hiccup.

Another useful application of this technique is to style a page as disabled or hidden until every element has loaded, preventing premature clicking and ensuring certain data is available to javascript before any events get initiated by the user.

randall
0
 
LVL 15

Expert Comment

by:stanscott2
ID: 18827315
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>
0
 
LVL 13

Expert Comment

by:AngryBinary
ID: 18827703
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.
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question