Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2815
  • Last Modified:

Javascript truncating text in a string

I'm returning data that was escaped, I can see the escaped data with the first alert (ie. DESIGN%20DOCUMENTS). I then assign the unescape data to variable desc. The next alert I see the unescape data with spaces (ie DESIGN DOCUMENTS). All is well at this point. Next I build a variable str with HTML using the variable desc to place the value in a text box, this is where it gets truncated, all that gets loaded into the text box is DESIGN not DESIGN DOCUMENTS. Any suggestions. Thanks.
alert(timeq.desc[0]);
     var desc = unescape(timeq.desc[0]);alert(desc);
     str+='<TD width="10%"><input class="sminputbox" style="text-align:right" OnKeyup="chkdols(this);" OnFocus="select();" name="prehrs1" value=' + timeq.hours[0] + ' size="4" maxlength="4"><\/TD>';
     str+='<TD width="30%"><input class="sminputbox" type="text" name="predesc1" value=' + desc + ' size="45" maxlength="150"><\/TD>';
     str+='<TD width="20%" id="preact1">' + timeq.workact[0] + '<\/TD>';
     str+='<TD width="20%" align="center"><img name="saves" id="1" valign="bottom" src="/Graphics/smpost_button.jpg" onClick="SavePre(this);" title="Click to save this transaction for current post date."></TD>';
     str+='<TD width="5%"><\/TD><\/TR><TR>';
document.getElementById("previousspan").innerHTML = str

Open in new window

0
headjava
Asked:
headjava
1 Solution
 
Sinoj SebastianCTO & OpenERP Project managerCommented:
use

str+='<TD width="30%"><input class="sminputbox" type="text" name="predesc1" value="' + desc + '" size="45" maxlength="150"><\/TD>';
     
alert(timeq.desc[0]);
     var desc = unescape(timeq.desc[0]);alert(desc);
     str+='<TD width="10%"><input class="sminputbox" style="text-align:right" OnKeyup="chkdols(this);" OnFocus="select();" name="prehrs1" value=' + timeq.hours[0] + ' size="4" maxlength="4"><\/TD>';
     str+='<TD width="30%"><input class="sminputbox" type="text" name="predesc1" value="' + desc + '" size="45" maxlength="150"><\/TD>';
     str+='<TD width="20%" id="preact1">' + timeq.workact[0] + '<\/TD>';
     str+='<TD width="20%" align="center"><img name="saves" id="1" valign="bottom" src="/Graphics/smpost_button.jpg" onClick="SavePre(this);" title="Click to save this transaction for current post date."></TD>';
     str+='<TD width="5%"><\/TD><\/TR><TR>';
document.getElementById("previousspan").innerHTML = str

Open in new window

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now