rejetto forum

Software => HTML & templates => HFS ~ HTTP File Server => RAWR-Designs => Topic started by: SpiderPig902 on March 05, 2010, 06:13:30 PM

Title: javascript error
Post by: SpiderPig902 on March 05, 2010, 06: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
Title: Re: javascript error
Post by: rejetto on March 08, 2010, 09:36:04 AM
i guess you get the problem when putting a single-quote ' in the searching field.
right?
Title: Re: javascript error
Post by: TSG on March 08, 2010, 10: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.
Title: Re: javascript error
Post by: rejetto on March 08, 2010, 07: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.}
Title: Re: javascript error
Post by: SpiderPig902 on May 24, 2010, 07: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
Title: Re: javascript error
Post by: rejetto on May 29, 2010, 06:07:26 PM
try this
this.value=='{.replace|'|\'|{.$search-data.}.}'
Title: Re: javascript error
Post by: TSG on June 12, 2010, 12:41:00 PM
I will include a fix in the small update I am making to the templates to address some issues.