Solved

unterminated string literal

Posted on 2010-08-12
6
616 Views
Last Modified: 2013-12-13
hello
i am getting an error of: unterminated string literal in a popup and cannot see where the error is. i have posted the code and would be grateful if someone could tell me how to troubleshoot this. it is only happening with 1 user as all the other users can action ok. many thanks
<td valign=\"top\"><a href=\"#\" onClick=\"PopUp('" . $action . "','winAvail','status=no,scrollbars=no,resizable=no,width=465,height=450');\">Action</a></td>



js

---------------------------------------------------



<script language="JavaScript" type="text/JavaScript"> 



function PopUp(theURL,winName,features) {

 var oWin = window.open(theURL,winName,features);

 oWin.focus();

}

</script>



action var

----------------------------------------------------------



$action = "action.php?id=$id&slot=$slot&service=$service&company=$company&user=$custname&department=$department&activity=$activity&item=$item&filebox=$filebox&date=$date&quantity=$quantity&type=$type&new=$new";

Open in new window

0
Comment
Question by:peter_coop
  • 2
  • 2
  • 2
6 Comments
 
LVL 58

Expert Comment

by:cyberkiwi
ID: 33424756
You probably have single quotes in the data somewhere
$action = str_replace("'", "''", "action.php?id=$id&slot=$slot&service=$service&company=$company&user=$custname&department=$department&activity=$activity&item=$item&filebox=$filebox&date=$date&quantity=$quantity&type=$type&new=$new");

Open in new window

0
 
LVL 5

Expert Comment

by:UrbanTwitch
ID: 33424760
Does the 1 user have their javascript disabled? Also... post the full error message they get.
0
 
LVL 58

Expert Comment

by:cyberkiwi
ID: 33424768
Try again
$action = str_replace("'", "\\'", "action.php?id=$id&slot=$slot&service=$service&company=$company&user=$custname&department=$department&activity=$activity&item=$item&filebox=$filebox&date=$date&quantity=$quantity&type=$type&new=$new");

Open in new window

0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:peter_coop
ID: 33424944
cyber
still the same. i have pulled the response html from firebug and can only think that there is a space in the user field?
<a onclick="PopUp('action.php?id=4087&amp;slot=&amp;service=Standard&amp;company=8&amp;user=David 

Brown&amp;department=84&amp;activity=Box Retrival&amp;item=CEN11706&amp;filebox=Only used with files&amp;date=12-08-2010 13:12:53&amp;quantity=0&amp;type=0&amp;new=1','winAvail','status=no,scrollbars=no,resizable=no,width=465,height=450');" href="#">Action</a>

Open in new window

0
 
LVL 5

Accepted Solution

by:
UrbanTwitch earned 250 total points
ID: 33425029
Right here:

date=12-08-2010 13:12:53&amp;

and also in filebox=Only used with files

Lastly there shouldn't be a return between Dan and Brown...
0
 

Author Closing Comment

by:peter_coop
ID: 33425105
thank you very much
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now