Hi respree-ga,
The error is not in your form, but in the results page that is
generated when I enter the search term 'monet' in the form and press
enter.
In the results page, which shows the results for the search term
'monet', you have a search box at the upper-left corner. it is in the
code for this search box, that the error occurs.
The code for the form appears in the file as follows :
==========HTML Code==================
213 |<INPUT SIZE="15"
214 |
215 |onClick="if(this. Products')this.
216 |
217 |onBlur="if(this. Products'" TYPE="text" NAME="keywords">
==========End HTML======================
As you can see, line number 215 contains the JavaScript onclick event
and the character 27 is the quote(') character. The problem here is
that both the onclick event and the onblur event contain incomplete
Javascript code.
Also, you can see that the starting doublequote(") in the onclick
event is NOT followed by the ending doublequote(") character.
Its looks to me that these are remenants of some JavaScript that you
missed removing from the code for the page.
I checked out the code for the search form on the initial page at
( http://www.respree.com/cgi-bin/SoftCart.exe/scstore/sitepages/formtest2.html?E+scstore
).
This page does not show any error. The HTML code for the form contains
the following code :
==========HTML Code==================
<input type="text" size="10" name="Keywords">
==========End HTML======================
As you can see, the INPUT tag here does not contain the onclick and
the onBlur events.
So, you have two options :
1) Remove the onClick and onBlur elements from the INPUT tag on the
results page. --OR--
2) Insert valid Javascript in place of the incomplete one currently
in the onClick and onBlur events.
I assume that you are generating the HTML page dynamically using some
sort of a template file for the HTML. In this case, you will have to
modify the HTML code in this template file in order to generate the
correct pages.
Hope this helps.
If you need any clarifications, just ask!
:) |
Clarification of Answer by
theta-ga
on
27 Nov 2002 11:38 PST
Hi respree-ga,
Noticed your clarification after I posted the answer. As you can
see, the problem was just what my answer specified.However the code
you posted as the one for the search box in your html file, does not
match with the code I got with the initial results page that contained
the error. That page contained the following code :
==========HTML Code==================
<FORM STYLE="margin-bottom:0;"
ACTION="/cgi-bin/SoftCart.exe/cgi-bin/pdbsearch.pl?U+scstore+cbwx8458ffe6abe6+cbwx8458ffe6abe6"
METHOD="POST">
<DIV ALIGN="left">
<INPUT TYPE="hidden" NAME="addtocart_page"
VALUE="/scstore/scpages/showcart.html">
<INPUT TYPE="hidden" NAME="results_page"
VALUE="/../pagegen/sresults.html">
<INPUT TYPE="hidden" NAME="max_results" VALUE="12">
<INPUT SIZE="15"
onClick="if(this. Products')this.
onBlur="if(this. Products'" TYPE="text" NAME="keywords">
<INPUT SRC="/scstore/images/btn-go3.gif" HEIGHT="14" WIDTH="21"
ALIGN="MIDDLE" TYPE="image" NAME="image">
<!-- END HEADER -->
<!-- Search results will be inserted below this line -->
<!-- BEGIN FOOTNOTE -->
</DIV>
</FORM>
==========End HTML======================
The onClick and onBlur elements contained incomplete(and hence
invalid) Javascript. The starting singlequote(') had no corresponding
ending singlequote('), and this was causing Internet Explorer to give
you the 'Unterminated String Constant' error. Now that you have
removed these elements, the error is gone.
The above code differs from the code you say you specified for the
line, which is :
<INPUT TYPE="text" SIZE="15" NAME="keywords" VALUE="Search Products"
onClick="if(this.value=='Search Products')this.value=''"
onBlur="if(this.value=='')this.value='Search Products'">
The HTML I got, was missing the VALUE="Search Products" tag and also
the parts parts of the Javascript code that contained the terms
[value] and [Search] .
This leads me to believe that the problem is most likely with the
Perl script you are using to insert the search results into the page.
It appears that the script replaces occurrances of the above terms in
the page, including the occurrances in the HTML code, leading to the
invalid Javascript.
Now that you know what you are looking for, it should be easy for you
to find the offending piece of code.
Hope this helps.
If you need any clarifications, just ask!
:)
|
Request for Answer Clarification by
respree-ga
on
27 Nov 2002 11:42 PST
Thank you for your answer. You are correct in your assumption that
the search results page is dynamically generated.
I've gone back and checked my HTML on the search "results" page, and
verified the actual file (as opposed to the dynamically generated html
page it produces) has the following.
<INPUT TYPE="text" size="15" name="keywords" value="Search Products"
onclick="if(this.value=='Search')this.value=''"
onblur="if(this.value=='')this.value='Search'">
but for some reason, when it displays the results, you are correct and
the syntax gets cut off (as described in your response). Do you know
the correct syntax to the above HTML to prevent this from happening?
I'd prefer to use this solution, if possible. I've tried flip
flopping the single quotes and double quotes, but that didn't seem to
help. Thanks again.
|
Clarification of Answer by
theta-ga
on
27 Nov 2002 11:52 PST
Hi respree-ga,
Did you check out your Perl script, as outlined in my clarification above ?
|
Request for Answer Clarification by
respree-ga
on
27 Nov 2002 12:06 PST
My fault and apologies. I should have read your answer a little more
carefully. Thank you.
|
Clarification of Answer by
theta-ga
on
27 Nov 2002 12:11 PST
Glad to be of help!
:)
|