rejetto forum
February 11, 2012, 02:36:35 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: This forum is free, you do NOT need to register to post. But you may.
PROBLEMS? QUESTIONS? CLICK HERE!
Fill the survey!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: javascript error  (Read 1023 times)
0 Members and 1 Guest are viewing this topic.
SpiderPig902
Regular poster
**
Offline Offline

United States United States

Posts: 24


View Profile Email
« on: March 05, 2010, 12:13:30 PM »

I am racking my brain trying to figure out this java script error. Every time my page loads i get a "Unterminated String Constant".
here is where the problem is. If i remove this form statement the error goes away:
<form action="/" method="get" style="padding:5px 0px 0px;margin:0px" name="simpleSearch"><input type="text" name="search" value="{.$search-data.}" onclick="if(this.value=='{.$search-data.}')this.value=''" style="width:100px"/> <input type="submit" value="Search"></form>


The actual line is the input box. if i remove that the error goes away also.

Does anyone know java enough to see what the problem is?


The section is "[FolderOptions]" in the Terayon" template.
Thanks in advance.

Tony
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11759


View Profile
« Reply #1 on: March 08, 2010, 03:36:04 AM »

i guess you get the problem when putting a single-quote ' in the searching field.
right?
Logged
TSG
Moderator
Insane poster
*****
Offline Offline

Australia Australia

Posts: 1916



View Profile WWW
« Reply #2 on: March 08, 2010, 04:17:03 AM »

I tested this, it wont do it for me...

Even with your theory with quotations rejetto.

What browser are you using and maybe provide a link (so long as there is nothing suss there) for the forum to test.
Logged

rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11759


View Profile
« Reply #3 on: March 08, 2010, 01:38:09 PM »

i guess your browser is just not displaying you the error.
it's easy to understand: literal strings in javascript must be escaped if you get as data the same character you are using as delimiter (single or double quotes).
if you have a value that's "a'b"
then this line
this.value=='{.$search-data.}'
will become
this.value=='a'b'
that's clearly a syntax error for the javascript interpreter.
i guess this may solve {.replace|'|\'|$1.}


i just noticed a similar problem in the default template. it's an html error on this line
value="{.?search.}"
that i can fix by {.replace|"|&quot;|$1.}
Logged
SpiderPig902
Regular poster
**
Offline Offline

United States United States

Posts: 24


View Profile Email
« Reply #4 on: May 24, 2010, 02:37:53 PM »

hi sorry for the delay in this. where would i put that line "{.replace|"|&quot;|$1.}". I cant replace the search string so im not sure where to replace it.

SP
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11759


View Profile
« Reply #5 on: May 29, 2010, 01:07:26 PM »

try this
this.value=='{.replace|'|\'|{.$search-data.}.}'
Logged
rejetto forum
« Reply #5 on: May 29, 2010, 01:07:26 PM »

Do you like this software? Consider even $2
 Logged
TSG
Moderator
Insane poster
*****
Offline Offline

Australia Australia

Posts: 1916



View Profile WWW
« Reply #6 on: June 12, 2010, 07:41:00 AM »

I will include a fix in the small update I am making to the templates to address some issues.
« Last Edit: June 12, 2010, 08:27:18 AM by TSG » Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!


Google visited last this page February 07, 2012, 08:57:43 AM
anything