Avatar of thedeal56
thedeal56

asked on 

Search on Postback (Unterminated String Literal)

Hello.  This one is going to be a tough one, because I really don't know what I'm talking about.  I am trying to get a search to work(an internal website search), and  I'm getting an error in firebug that says "unterminated string literal".  Here's the code that it's flagging:
 /*Clear Search cookie*/ EkSearch.clrCookie();/*Set search results*/ document.getElementById('__ecmsearchresult').innerHTML="<div class=\"searchResultsHeader\"><h3><span class=\"resultslabel\">Results</span> <span class=\"beginPageCount\">1</span> - <span class=\"endPageCount\">10</span> of <span class=\"totalCount\">130</span> for <span class=\"searchTerms\">test</span>.(<span class=\"searchDuration\">0.72</span> seconds)</h3></div><h4>
112

Here's the real-deal code:

Imports Ektron.Cms.WebSearch.SearchData

Partial Class SearchPage
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not IsCallback AndAlso Not IsPostBack Then
            Dim requestData As SearchRequestData = New SearchRequestData()
            requestData.CurrentPage = 1
            requestData.EnablePaging = True
            requestData.FolderID = 0
            requestData.LanguageID = 1033
            requestData.SearchText = Request.QueryString("searchtext")

            If (requestData.SearchText IsNot Nothing) AndAlso (requestData.SearchText.Length > 0) Then
                Dim record_count As Integer = WebSearch1.LoadSearch(requestData)
                Dim manager As ClientScriptManager = Page.ClientScript

                'Clear the search cookie to prevent any old searches from being performed again.
                'Populate the HTML element identified by the ResultTagId property with the search results (escape quotes in Javascript as \").
                'Set the search text box in the server control with the text entered on the previous page.
                If Not manager.IsStartupScriptRegistered("setSearchResults") Then
                    manager.RegisterStartupScript(Me.GetType, "setSearchResults", "/*Clear Search cookie*/ EkSearch.clrCookie();" + _
                            "/*Set search results*/ document.getElementById('" + WebSearch1.ResultTagId + _
                            "').innerHTML=""" + WebSearch1.Text.Replace("""", "\""") + """;" + _
                            "/*Set search text box to your text*/ document.getElementById('ecmBasicKeywords').value = '" + _
                            requestData.SearchText + "';""", True)
                End If

                'C# equivalent:
                'manager.RegisterStartupScript(this.GetType(), "setSearchResults", "/*Clear Search cookie*/ EkSearch.clrCookie();" +  
                '                                                                   "/*Set search results*/ document.getElementById('" + WebSearch1.ResultTagId + "').innerHTML=\"" + WebSearch1.Text.Replace("\"", "\\\"") + "\";" +
                '                                                                   "/*Set search text box to yuor text*/document.getElementById('ecmBasicKeywords').value = '" + requestData.SearchText + "';", true);

            End If
        End If
    End Sub
End Class

That VB code is originally from a demo of a internal site search.  The original code (the demo code) is designed to work as a framed search.  Search input in the top frame and result display in the bottom frame.  

Here's the code that passes the search variable in the Original code:

Partial Class Developer_Websearch_CallSearch
    Inherits System.Web.UI.Page

    Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSearch.Click
        Dim myScript As String
        Dim ExecuteScript As ClientScriptManager

        'Load the page with the websearch server control in the bottom frame using Javascript
        ExecuteScript = Page.ClientScript
        myScript = "top.mainFrame.bottomFrame.document.location.href=""SearchPage.aspx?searchtext=" + Trim(txtSearchText.Text) + """;"
        ExecuteScript.RegisterStartupScript(Me.GetType, "searchr", myScript, True)
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Page.ClientScript.RegisterHiddenField("__EVENTTARGET", btnSearch.ClientID)

        'This statement above is required when using IE to make the <Enter> key submit the form correctly.
        'Please note that this problem was not observed in FireFox.

        'If you do not set the __EVENTTARGET manually, the form is submitted with no name/value pair for the button and no event will be fired.
        'When we manually pre-set the __EVENTTARGET, the default event for the specified button (btnSearch_Click event handler in this case)
        'will be fired (which loads the search page in the lower frame.)

        'Another solution to this problem is to include this Javascript function in the aspx page which
        'fires the search in the bottom frame when the Enter key is hit in the upper frame.

        '<script type="text/javascript" language="JavaScript">
        '   document.onkeydown = checkKeycode;
        '   function checkKeycode() {
        '       var keycode;
        '       If (window.event) Then
        '       {
        '           keycode = window.event.keyCode;
        '           if (keycode==13)
        '           {
        '               if (document.getElementById('txtSearchText')!=null)
        '               {
        '                   var searchText = document.getElementById('txtSearchText').value;
        '                   window.top.mainFrame.bottomFrame.document.location.href="SearchPage.aspx?searchtext=" + searchText;
        '               }
        '           }
        '       }
        '}
        '</script>

    End Sub
End Class


Here's my alteration of that code to account for not using frames. (I am just passing the variable to another url instead of using frames)

This is the only line that I changed:
myScript = "location.href=""SearchPage.aspx?searchtext=" + Trim(txtSearchText.Text) + """;"
       

The frame search will not work for me, so I am trying to make it work in a different way.  Since I know next to nothing about asp .net and VB/javascript, making it work in a different way is proving to be quite a challenge.  

I know that this post is probably lacking some crucial information, so please help me out and tell me what else I need to post.  If I need to clean up this post to make it more easy to read, please let me know that too.  Thanks a lot for reading this far!
Visual Basic ClassicJavaScriptASP.NET

Avatar of undefined
Last Comment
philipjonathan
Avatar of philipjonathan
philipjonathan
Flag of New Zealand image

Hi, here's a long shot: Is it because on the line that causes it error, the string was not terminated with " (quote)
 /*Clear Search cookie*/ EkSearch.clrCookie();/*Set search results*/ document.getElementById('__ecmsearchresult').innerHTML="

Results 1 - 10 of 130 for test.(0.72 seconds)

"   <--- add a " here

Seems like the code in my prev comment is truncated. Here it is:
/*Clear Search cookie*/ EkSearch.clrCookie();/*Set search results*/ document.getElementById('__ecmsearchresult').innerHTML="<div class=\"searchResultsHeader\"><h3><span class=\"resultslabel\">Results</span> <span class=\"beginPageCount\">1</span> - <span class=\"endPageCount\">10</span> of <span class=\"totalCount\">130</span> for <span class=\"searchTerms\">test</span>.(<span class=\"searchDuration\">0.72</span> seconds)</h3></div><h4>"   <--- Add quote here

Open in new window

Avatar of thedeal56
thedeal56

ASKER

I haven't gotten a chance to try it out yet, but I just wanted to post and say thanks for the comment!  This problem has seriously been driving me crazy, and it seems like there's a ray of hope now haha.  
Glad that it encouraged you, but then as I said, it was a long shot, may or may not be the solution ... :)
Btw, here's your VB code that generate the problematic line. Another guess of mine is, it is WebSearch1.Text.Replace that is causing the the line not generated correctly change it to:
WebSearch1.Text.Replace("""", "\\""")  ' <--- add a '\' backslash here
If Not manager.IsStartupScriptRegistered("setSearchResults") Then
  manager.RegisterStartupScript(Me.GetType, "setSearchResults", "/*Clear Search cookie*/ EkSearch.clrCookie();" + _
    "/*Set search results*/ document.getElementById('" + WebSearch1.ResultTagId + _
    "').innerHTML=""" + WebSearch1.Text.Replace("""", "\\""") + """;" + _
    "/*Set search text box to your text*/ document.getElementById('ecmBasicKeywords').value = '" + _
    requestData.SearchText + "';""", True)
End If

Open in new window

Avatar of thedeal56
thedeal56

ASKER

I can't seem to find where those table header tags are being generated.  I added the backslash, and it now says "missing ; before statement".  I thought I might should post the entire section code that the error is found in.  You can see the actual results of the search showing up in script, but they will not display on the site.  Thanks again for all your help.  
<script type="text/javascript">
//<![CDATA[
/*Clear Search cookie*/ EkSearch.clrCookie();/*Set search results*/ document.getElementById('__ecmsearchresult').innerHTML="<div class=\\"searchResultsHeader\\"><h3><span class=\\"resultslabel\\">Results</span> <span class=\\"beginPageCount\\">1</span> - <span class=\\"endPageCount\\">10</span> of <span class=\\"totalCount\\">130</span> for <span class=\\"searchTerms\\">test</span>.(<span class=\\"searchDuration\\">0.91</span> seconds)</h3></div><h4>
<img src=\\"http://cms.murfreesborotn.gov/stage/WorkArea/images/application/HTML.gif\\" alt=\\"Result Type\\" /><a title=\\"Wellness Services\\" href=\\"/stage/default.aspx?ekmenu=126&id=3040&terms=test\\"\\">Wellness Services</a><span class=\\"dateTime\\">6/5/2008 11:02:45 AM</span>
</h4>
<div class=\\"resultPreview\\">
<p>MPRD Fitness/Wellness Services Weight Room Orientations - Free with admission! Our wellness staff will show the proper way to use each piece of equipment, ensuring that you get the best and safest workout each time. Locations : Sports*Com and Patterson Community Center Fee : Free with General admiss<span class=\\"ellipsis\\">...</span></p>
<div class=\\"resultPreviewDetails\\"> 
<span class=\\"resultPreviewId\\">ID=3040</span>
<span class=\\"resultPreviewSize\\">Size=4 KB</span>
</div>
</div><h4>
<img src=\\"http://cms.murfreesborotn.gov/stage/WorkArea/images/application/adobe-pdf.gif\\" alt=\\"Result Type\\" /><a title=\\"Reduced Pressure Backflow Prevention Device\\" target=\\"_self\\" href=\\"/stage/uploadedFiles/government/water_and_sewer/cross_connection/reduced_pressure_backflow_prevention_device.pdf\\"\\">Reduced Pressure Backflow Prevention Device</a><span class=\\"dateTime\\">11/13/2007 3:25:56 PM</span>
</h4>
<div class=\\"resultPreview\\">
<p>. Reduced Pressure Backflow Prevention Device. MURFREESBORO CROSS CONNECTION CONTROL INSTALLATION SPECIFICATION Backflow Device Requirements Reduced Pressure Backflow Device Reduced Pressure Backflow Prevention Device 1) A person certified by the Tennessee Department of Environment and Conservati<span class=\\"ellipsis\\">...</span></p>
<div class=\\"resultPreviewDetails\\"> 
<span class=\\"resultPreviewId\\">ID=3350</span>
<span class=\\"resultPreviewSize\\">Size=242 KB</span>
</div>
</div><h4>
<img src=\\"http://cms.murfreesborotn.gov/stage/WorkArea/images/application/HTML.gif\\" alt=\\"Result Type\\" /><a title=\\"faq - drivers licenses\\" href=\\"/stage/default.aspx?id=3196&terms=test\\"\\">faq - drivers licenses</a><span class=\\"dateTime\\">11/2/2007 11:31:13 AM</span>
</h4>
<div class=\\"resultPreview\\">
<p>Driver's Licenses New residents of the city have 30 days after establishing permanent residency to change their out of state drivers license to a valid Tennessee license. If you have a valid license from another state, only a vision test. faq - drivers licenses. Driver's Licenses New res<span class=\\"ellipsis\\">...</span></p>
<div class=\\"resultPreviewDetails\\"> 
<span class=\\"resultPreviewId\\">ID=3196</span>
<span class=\\"resultPreviewSize\\">Size=2 KB</span>
</div>
</div><h4>
<img src=\\"http://cms.murfreesborotn.gov/stage/WorkArea/images/application/adobe-pdf.gif\\" alt=\\"Result Type\\" /><a title=\\"Double Check Detector Assembly\\" target=\\"_self\\" href=\\"/stage/uploadedFiles/government/water_and_sewer/cross_connection/double_check_detector_assembly.pdf\\"\\">Double Check Detector Assembly</a><span class=\\"dateTime\\">11/13/2007 3:25:40 PM</span>
</h4>
<div class=\\"resultPreview\\">
<p>. Double Check Detector Assembly. MURFREESBORO CROSS CONNECTION CONTROL INSTALLATION SPECIFICATIONS Backflow Device Requirements Double Check Detector Assembly Double Check Detector Assembly 1. All required devices must be installed pursuant to Murfreesboro City Code, Chapter 33, Sec<span class=\\"ellipsis\\">...</span></p>
<div class=\\"resultPreviewDetails\\"> 
<span class=\\"resultPreviewId\\">ID=3348</span>
<span class=\\"resultPreviewSize\\">Size=32 KB</span>
</div>
</div><h4>
<img src=\\"http://cms.murfreesborotn.gov/stage/WorkArea/images/application/HTML.gif\\" alt=\\"Result Type\\" /><a title=\\"Job Listings\\" href=\\"/stage/default.aspx?ekmenu=128&id=1826&terms=test\\"\\">Job Listings</a><span class=\\"dateTime\\">6/18/2008 4:11:11 PM</span>
</h4>
<div class=\\"resultPreview\\">
<p>City Job Listings (current as of 06-16-08) FULL-TIME General Administration Assistant City Recorder/Chief Accountant 4,901.33 - 6,089.92 monthly DOQ&amp; E Certified Public Accountant (CPA) licensed to practice in TN. 5 years professional experience; governmental accounting and auditing preferred. A<span class=\\"ellipsis\\">...</span></p>
<div class=\\"resultPreviewDetails\\"> 
<span class=\\"resultPreviewId\\">ID=1826</span>
<span class=\\"resultPreviewSize\\">Size=5 KB</span>
</div>
</div><h4>
<img src=\\"http://cms.murfreesborotn.gov/stage/WorkArea/images/application/HTML.gif\\" alt=\\"Result Type\\" /><a title=\\"test\\" href=\\"/stage/default.aspx?ekmenu=100&id=4338&terms=test\\"\\">test</a><span class=\\"dateTime\\">12/21/2007 10:18:07 AM</span>
</h4>
<div class=\\"resultPreview\\">
<p>This is a test. . test. This is a test.. Summary This is a test. . <span class=\\"ellipsis\\">...</span></p>
<div class=\\"resultPreviewDetails\\"> 
<span class=\\"resultPreviewId\\">ID=4338</span>
<span class=\\"resultPreviewSize\\">Size=1 KB</span>
</div>
</div><h4>
<img src=\\"http://cms.murfreesborotn.gov/stage/WorkArea/images/application/HTML.gif\\" alt=\\"Result Type\\" /><a title=\\"test\\" href=\\"/stage/default.aspx?ekmenu=100&id=3962&terms=test\\"\\">test</a><span class=\\"dateTime\\">12/4/2007 1:47:14 PM</span>
</h4>
<div class=\\"resultPreview\\">
<p>test . test. Summary test . <span class=\\"ellipsis\\">...</span></p>
<div class=\\"resultPreviewDetails\\"> 
<span class=\\"resultPreviewId\\">ID=3962</span>
<span class=\\"resultPreviewSize\\">Size=1 KB</span>
</div>
</div><h4>
<img src=\\"http://cms.murfreesborotn.gov/stage/WorkArea/images/application/HTML.gif\\" alt=\\"Result Type\\" /><a title=\\"test\\" href=\\"/stage/default.aspx?ekmenu=20&id=3126&terms=test\\"\\">test</a><span class=\\"dateTime\\">10/29/2007 2:45:57 PM</span>
</h4>
<div class=\\"resultPreview\\">
<p>City of Murfreesboro . test. City of Murfreesboro. Summary City of Murfreesboro . <span class=\\"ellipsis\\">...</span></p>
<div class=\\"resultPreviewDetails\\"> 
<span class=\\"resultPreviewId\\">ID=3126</span>
<span class=\\"resultPreviewSize\\">Size=1 KB</span>
</div>
</div><h4>
<img src=\\"http://cms.murfreesborotn.gov/stage/WorkArea/images/application/adobe-pdf.gif\\" alt=\\"Result Type\\" /><a title=\\"detective\\" target=\\"_self\\" href=\\"/stage/uploadedFiles/government/Personnel/Job_Descriptions/Police/police_full-time/Detective.pdf\\"\\">detective</a><span class=\\"dateTime\\">7/20/2007 10:02:46 AM</span>
</h4>
<div class=\\"resultPreview\\">
<p>. detective. JOB DESCRIPTION MURFREESBORO POLICE DEPARTMENT DETECTIVE 1. JOB TITLE: DETECTIVE 2. DEFINITION: The Police Detective is a Police Officer who can perform all of the functions and has all of the knowledge, skills, and other abilities described in the Police Officers job descri<span class=\\"ellipsis\\">...</span></p>
<div class=\\"resultPreviewDetails\\"> 
<span class=\\"resultPreviewId\\">ID=1514</span>
<span class=\\"resultPreviewSize\\">Size=20 KB</span>
</div>
</div><h4>
<img src=\\"http://cms.murfreesborotn.gov/stage/WorkArea/images/application/adobe-pdf.gif\\" alt=\\"Result Type\\" /><a title=\\"application - part-time\\" target=\\"_self\\" href=\\"/stage/uploadedFiles/government/Personnel/app_parttime.pdf\\"\\">application - part-time</a><span class=\\"dateTime\\">7/19/2007 8:30:00 AM</span>
</h4>
<div class=\\"resultPreview\\">
<p>. application - part-time. PLEASE PRINT Name: Please complete entire Application for Employment carefully, accurately, and legibly. The City may consider the neatness and the completeness of an Application in selecting an employee. CITY OF MURFREESBORO APPLICATION FOR PART-TIME OR SEASONAL EMPLOYMENT <span class=\\"ellipsis\\">...</span></p>
<div class=\\"resultPreviewDetails\\"> 
<span class=\\"resultPreviewId\\">ID=1110</span>
<span class=\\"resultPreviewSize\\">Size=30 KB</span>
</div>
</div><div id=\\"navbar\\"><ul class=\\"ektronPaging\\"><li class=\\"page\\">1</li><li class=\\"page\\"><a href=\\"#\\" onclick=\\"__LoadSearchResult(EkSearch.getArguements(),'control=__ecmsearchresult&amp;__ecmcurrentpage=2');return false;\\">2</a></li><li class=\\"page\\"><a href=\\"#\\" onclick=\\"__LoadSearchResult(EkSearch.getArguements(),'control=__ecmsearchresult&amp;__ecmcurrentpage=3');return false;\\">3</a></li><li class=\\"page\\"><a href=\\"#\\" onclick=\\"__LoadSearchResult(EkSearch.getArguements(),'control=__ecmsearchresult&amp;__ecmcurrentpage=4');return false;\\">4</a></li><li class=\\"page\\"><a href=\\"#\\" onclick=\\"__LoadSearchResult(EkSearch.getArguements(),'control=__ecmsearchresult&amp;__ecmcurrentpage=5');return false;\\">5</a></li><li class=\\"page\\"><a href=\\"#\\" onclick=\\"__LoadSearchResult(EkSearch.getArguements(),'control=__ecmsearchresult&amp;__ecmcurrentpage=6');return false;\\">6</a></li><li class=\\"page\\"><a href=\\"#\\" onclick=\\"__LoadSearchResult(EkSearch.getArguements(),'control=__ecmsearchresult&amp;__ecmcurrentpage=7');return false;\\">7</a></li><li class=\\"page\\"><a href=\\"#\\" onclick=\\"__LoadSearchResult(EkSearch.getArguements(),'control=__ecmsearchresult&amp;__ecmcurrentpage=8');return false;\\">8</a></li><li class=\\"page\\"><a href=\\"#\\" onclick=\\"__LoadSearchResult(EkSearch.getArguements(),'control=__ecmsearchresult&amp;__ecmcurrentpage=9');return false;\\">9</a></li><li class=\\"page\\"><a href=\\"#\\" onclick=\\"__LoadSearchResult(EkSearch.getArguements(),'control=__ecmsearchresult&amp;__ecmcurrentpage=10');return false;\\">10</a></li><li class=\\"next\\"><a href=\\"#\\" onclick=\\"__LoadSearchResult(EkSearch.getArguements(),'control=__ecmsearchresult&amp;__ecmcurrentpage=2');return false;\\">Next</a></li></ul></div>";/*Set search text box to your text*/ document.getElementById('ecmBasicKeywords').value = 'test';"
WebForm_InitCallback();//]]>
</script>

Open in new window

Avatar of thedeal56
thedeal56

ASKER

Here's more code.

<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
    theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>




<script type="text/javascript" src="/stage/WebResource.axd?d=TtqWUV9bWf3iFt8RK4GNkA2&t=633440223204195736">
1function WebForm_PostBackOptions(eventTarget, eventArgument, validation, validationGroup, actionUrl, trackFocus, clientSubmit) {
2 this.eventTarget = eventTarget;
3 this.eventArgument = eventArgument;
4 this.validation = validation;
5 this.validationGroup = validationGroup;
6 this.actionUrl = actionUrl;
7 this.trackFocus = trackFocus;
8 this.clientSubmit = clientSubmit;
9}
10function WebForm_DoPostBackWithOptions(options) {
11 var validationResult = true;
12 if (options.validation) {
13 if (typeof(Page_ClientValidate) == 'function') {
14 validationResult = Page_ClientValidate(options.validationGroup);
15 }
16 }
17 if (validationResult) {
18 if ((typeof(options.actionUrl) != "undefined") && (options.actionUrl != null) && (options.actionUrl.length > 0)) {
19 theForm.action = options.actionUrl;
20 }
21 if (options.trackFocus) {
22 var lastFocus = theForm.elements["__LASTFOCUS"];
23 if ((typeof(lastFocus) != "undefined") && (lastFocus != null)) {
24 if (typeof(document.activeElement) == "undefined") {
25 lastFocus.value = options.eventTarget;
26 }
27 else {
28 var active = document.activeElement;
29 if ((typeof(active) != "undefined") && (active != null)) {
30 if ((typeof(active.id) != "undefined") && (active.id != null) && (active.id.length > 0)) {
31 lastFocus.value = active.id;
32 }
33 else if (typeof(active.name) != "undefined") {
34 lastFocus.value = active.name;
35 }
36 }
37 }
38 }
39 }
40 }
41 if (options.clientSubmit) {
42 __doPostBack(options.eventTarget, options.eventArgument);
43 }
44}
45var __pendingCallbacks = new Array();
46var __synchronousCallBackIndex = -1;
47function WebForm_DoCallback(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync) {
48 var postData = __theFormPostData +
49 "__CALLBACKID=" + WebForm_EncodeCallback(eventTarget) +
50 "&__CALLBACKPARAM=" + WebForm_EncodeCallback(eventArgument);
51 if (theForm["__EVENTVALIDATION"]) {
52 postData += "&__EVENTVALIDATION=" + WebForm_EncodeCallback(theForm["__EVENTVALIDATION"].value);
53 }
54 var xmlRequest,e;
55 try {
56 xmlRequest = new XMLHttpRequest();
57 }
58 catch(e) {
59 try {
60 xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
61 }
62 catch(e) {
63 }
64 }
65 var setRequestHeaderMethodExists = true;
66 try {
67 setRequestHeaderMethodExists = (xmlRequest && xmlRequest.setRequestHeader);
68 }
69 catch(e) {}
70 var callback = new Object();
71 callback.eventCallback = eventCallback;
72 callback.context = context;
73 callback.errorCallback = errorCallback;
74 callback.async = useAsync;
75 var callbackIndex = WebForm_FillFirstAvailableSlot(__pendingCallbacks, callback);
76 if (!useAsync) {
77 if (__synchronousCallBackIndex != -1) {
78 __pendingCallbacks[__synchronousCallBackIndex] = null;
79 }
80 __synchronousCallBackIndex = callbackIndex;
81 }
82 if (setRequestHeaderMethodExists) {
83 xmlRequest.onreadystatechange = WebForm_CallbackComplete;
84 callback.xmlRequest = xmlRequest;
85 xmlRequest.open("POST", theForm.action, true);
86 xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
87 xmlRequest.send(postData);
88 return;
89 }
90 callback.xmlRequest = new Object();
91 var callbackFrameID = "__CALLBACKFRAME" + callbackIndex;
92 var xmlRequestFrame = document.frames[callbackFrameID];
93 if (!xmlRequestFrame) {
94 xmlRequestFrame = document.createElement("IFRAME");
95 xmlRequestFrame.width = "1";
96 xmlRequestFrame.height = "1";
97 xmlRequestFrame.frameBorder = "0";
98 xmlRequestFrame.id = callbackFrameID;
99 xmlRequestFrame.name = callbackFrameID;
100 xmlRequestFrame.style.position = "absolute";
101 xmlRequestFrame.style.top = "-100px"
102 xmlRequestFrame.style.left = "-100px";
103 try {
104 if (callBackFrameUrl) {
105 xmlRequestFrame.src = callBackFrameUrl;
106 }
107 }
108 catch(e) {}
109 document.body.appendChild(xmlRequestFrame);
110 }
111 var interval = window.setInterval(function() {
112 xmlRequestFrame = document.frames[callbackFrameID];
113 if (xmlRequestFrame && xmlRequestFrame.document) {
114 window.clearInterval(interval);
115 xmlRequestFrame.document.write("");
116 xmlRequestFrame.document.close();
117 xmlRequestFrame.document.write('<form method="post"><input type="hidden" name="__CALLBACKLOADSCRIPT" value="t"></form>');
118 xmlRequestFrame.document.close();
119 xmlRequestFrame.document.forms[0].action = theForm.action;
120 var count = __theFormPostCollection.length;
121 var element;
122 for (var i = 0; i < count; i++) {
123 element = __theFormPostCollection[i];
124 if (element) {
125 var fieldElement = xmlRequestFrame.document.createElement("INPUT");
126 fieldElement.type = "hidden";
127 fieldElement.name = element.name;
128 fieldElement.value = element.value;
129 xmlRequestFrame.document.forms[0].appendChild(fieldElement);
130 }
131 }
132 var callbackIdFieldElement = xmlRequestFrame.document.createElement("INPUT");
133 callbackIdFieldElement.type = "hidden";
134 callbackIdFieldElement.name = "__CALLBACKID";
135 callbackIdFieldElement.value = eventTarget;
136 xmlRequestFrame.document.forms[0].appendChild(callbackIdFieldElement);
137 var callbackParamFieldElement = xmlRequestFrame.document.createElement("INPUT");
138 callbackParamFieldElement.type = "hidden";
139 callbackParamFieldElement.name = "__CALLBACKPARAM";
140 callbackParamFieldElement.value = eventArgument;
141 xmlRequestFrame.document.forms[0].appendChild(callbackParamFieldElement);
142 if (theForm["__EVENTVALIDATION"]) {
143 var callbackValidationFieldElement = xmlRequestFrame.document.createElement("INPUT");
144 callbackValidationFieldElement.type = "hidden";
145 callbackValidationFieldElement.name = "__EVENTVALIDATION";
146 callbackValidationFieldElement.value = theForm["__EVENTVALIDATION"].value;
147 xmlRequestFrame.document.forms[0].appendChild(callbackValidationFieldElement);
148 }
149 var callbackIndexFieldElement = xmlRequestFrame.document.createElement("INPUT");
150 callbackIndexFieldElement.type = "hidden";
151 callbackIndexFieldElement.name = "__CALLBACKINDEX";
152 callbackIndexFieldElement.value = callbackIndex;
153 xmlRequestFrame.document.forms[0].appendChild(callbackIndexFieldElement);
154 xmlRequestFrame.document.forms[0].submit();
155 }
156 }, 10);
157}
158function WebForm_CallbackComplete() {
159 for (i = 0; i < __pendingCallbacks.length; i++) {
160 callbackObject = __pendingCallbacks[i];
161 if (callbackObject && callbackObject.xmlRequest && (callbackObject.xmlRequest.readyState == 4)) {
162 WebForm_ExecuteCallback(callbackObject);
163 if (!__pendingCallbacks[i].async) {
164 __synchronousCallBackIndex = -1;
165 }
166 __pendingCallbacks[i] = null;
167 var callbackFrameID = "__CALLBACKFRAME" + i;
168 var xmlRequestFrame = document.getElementById(callbackFrameID);
169 if (xmlRequestFrame) {
170 xmlRequestFrame.parentNode.removeChild(xmlRequestFrame);
171 }
172 }
173 }
174}
175function WebForm_ExecuteCallback(callbackObject) {
176 var response = callbackObject.xmlRequest.responseText;
177 if (response.charAt(0) == "s") {
178 if ((typeof(callbackObject.eventCallback) != "undefined") && (callbackObject.eventCallback != null)) {
179 callbackObject.eventCallback(response.substring(1), callbackObject.context);
180 }
181 }
182 else if (response.charAt(0) == "e") {
183 if ((typeof(callbackObject.errorCallback) != "undefined") && (callbackObject.errorCallback != null)) {
184 callbackObject.errorCallback(response.substring(1), callbackObject.context);
185 }
186 }
187 else {
188 var separatorIndex = response.indexOf("|");
189 if (separatorIndex != -1) {
190 var validationFieldLength = parseInt(response.substring(0, separatorIndex));
191 if (!isNaN(validationFieldLength)) {
192 var validationField = response.substring(separatorIndex + 1, separatorIndex + validationFieldLength + 1);
193 if (validationField != "") {
194 var validationFieldElement = theForm["__EVENTVALIDATION"];
195 if (!validationFieldElement) {
196 validationFieldElement = document.createElement("INPUT");
197 validationFieldElement.type = "hidden";
198 validationFieldElement.name = "__EVENTVALIDATION";
199 theForm.appendChild(validationFieldElement);
200 }
201 validationFieldElement.value = validationField;
202 }
203 if ((typeof(callbackObject.eventCallback) != "undefined") && (callbackObject.eventCallback != null)) {
204 callbackObject.eventCallback(response.substring(separatorIndex + validationFieldLength + 1), callbackObject.context);
205 }
206 }
207 }
208 }
209}
210function WebForm_FillFirstAvailableSlot(array, element) {
211 var i;
212 for (i = 0; i < array.length; i++) {
213 if (!array[i]) break;
214 }
215 array[i] = element;
216 return i;
217}
218var __nonMSDOMBrowser = (window.navigator.appName.toLowerCase().indexOf('explorer') == -1);
219var __theFormPostData = "";
220var __theFormPostCollection = new Array();
221function WebForm_InitCallback() {
222 var count = theForm.elements.length;
223 var element;
224 for (var i = 0; i < count; i++) {
225 element = theForm.elements[i];
226 var tagName = element.tagName.toLowerCase();
227 if (tagName == "input") {
228 var type = element.type;
229 if ((type == "text" || type == "hidden" || type == "password" ||
230 ((type == "checkbox" || type == "radio") && element.checked)) &&
231 (element.id != "__EVENTVALIDATION")) {
232 WebForm_InitCallbackAddField(element.name, element.value);
233 }
234 }
235 else if (tagName == "select") {
236 var selectCount = element.options.length;
237 for (var j = 0; j < selectCount; j++) {
238 var selectChild = element.options[j];
239 if (selectChild.selected == true) {
240 WebForm_InitCallbackAddField(element.name, element.value);
241 }
242 }
243 }
244 else if (tagName == "textarea") {
245 WebForm_InitCallbackAddField(element.name, element.value);
246 }
247 }
248}
249function WebForm_InitCallbackAddField(name, value) {
250 var nameValue = new Object();
251 nameValue.name = name;
252 nameValue.value = value;
253 __theFormPostCollection[__theFormPostCollection.length] = nameValue;
254 __theFormPostData += name + "=" + WebForm_EncodeCallback(value) + "&";
255}
256function WebForm_EncodeCallback(parameter) {
257 if (encodeURIComponent) {
258 return encodeURIComponent(parameter);
259 }
260 else {
261 return escape(parameter);
262 }
263}
264var __disabledControlArray = new Array();
265function WebForm_ReEnableControls() {
266 if (typeof(__enabledControlArray) == 'undefined') {
267 return false;
268 }
269 var disabledIndex = 0;
270 for (var i = 0; i < __enabledControlArray.length; i++) {
271 var c;
272 if (__nonMSDOMBrowser) {
273 c = document.getElementById(__enabledControlArray[i]);
274 }
275 else {
276 c = document.all[__enabledControlArray[i]];
277 }
278 if ((typeof(c) != "undefined") && (c != null) && (c.disabled == true)) {
279 c.disabled = false;
280 __disabledControlArray[disabledIndex++] = c;
281 }
282 }
283 setTimeout("WebForm_ReDisableControls()", 0);
284 return true;
285}
286function WebForm_ReDisableControls() {
287 for (var i = 0; i < __disabledControlArray.length; i++) {
288 __disabledControlArray[i].disabled = true;
289 }
290}
291function WebForm_FireDefaultButton(event, target) {
292 if (event.keyCode == 13 && !(event.srcElement && (event.srcElement.tagName.toLowerCase() == "textarea"))) {
293 var defaultButton;
294 if (__nonMSDOMBrowser) {
295 defaultButton = document.getElementById(target);
296 }
297 else {
298 defaultButton = document.all[target];
299 }
300 if (defaultButton && typeof(defaultButton.click) != "undefined") {
301 defaultButton.click();
302 event.cancelBubble = true;
303 if (event.stopPropagation) event.stopPropagation();
304 return false;
305 }
306 }
307 return true;
308}
309function WebForm_GetScrollX() {
310 if (__nonMSDOMBrowser) {
311 return window.pageXOffset;
312 }
313 else {
314 if (document.documentElement && document.documentElement.scrollLeft) {
315 return document.documentElement.scrollLeft;
316 }
317 else if (document.body) {
318 return document.body.scrollLeft;
319 }
320 }
321 return 0;
322}
323function WebForm_GetScrollY() {
324 if (__nonMSDOMBrowser) {
325 return window.pageYOffset;
326 }
327 else {
328 if (document.documentElement && document.documentElement.scrollTop) {
329 return document.documentElement.scrollTop;
330 }
331 else if (document.body) {
332 return document.body.scrollTop;
333 }
334 }
335 return 0;
336}
337function WebForm_SaveScrollPositionSubmit() {
338 if (__nonMSDOMBrowser) {
339 theForm.elements['__SCROLLPOSITIONY'].value = window.pageYOffset;
340 theForm.elements['__SCROLLPOSITIONX'].value = window.pageXOffset;
341 }
342 else {
343 theForm.__SCROLLPOSITIONX.value = WebForm_GetScrollX();
344 theForm.__SCROLLPOSITIONY.value = WebForm_GetScrollY();
345 }
346 if ((typeof(this.oldSubmit) != "undefined") && (this.oldSubmit != null)) {
347 return this.oldSubmit();
348 }
349 return true;
350}
351function WebForm_SaveScrollPositionOnSubmit() {
352 theForm.__SCROLLPOSITIONX.value = WebForm_GetScrollX();
353 theForm.__SCROLLPOSITIONY.value = WebForm_GetScrollY();
354 if ((typeof(this.oldOnSubmit) != "undefined") && (this.oldOnSubmit != null)) {
355 return this.oldOnSubmit();
356 }
357 return true;
358}
359function WebForm_RestoreScrollPosition() {
360 if (__nonMSDOMBrowser) {
361 window.scrollTo(theForm.elements['__SCROLLPOSITIONX'].value, theForm.elements['__SCROLLPOSITIONY'].value);
362 }
363 else {
364 window.scrollTo(theForm.__SCROLLPOSITIONX.value, theForm.__SCROLLPOSITIONY.value);
365 }
366 if ((typeof(theForm.oldOnLoad) != "undefined") && (theForm.oldOnLoad != null)) {
367 return theForm.oldOnLoad();
368 }
369 return true;
370}
371function WebForm_TextBoxKeyHandler(event) {
372 if (event.keyCode == 13) {
373 var target;
374 if (__nonMSDOMBrowser) {
375 target = event.target;
376 }
377 else {
378 target = event.srcElement;
379 }
380 if ((typeof(target) != "undefined") && (target != null)) {
381 if (typeof(target.onchange) != "undefined") {
382 target.onchange();
383 event.cancelBubble = true;
384 if (event.stopPropagation) event.stopPropagation();
385 return false;
386 }
387 }
388 }
389 return true;
390}
391function WebForm_AppendToClassName(element, className) {
392 var current = element.className;
393 if (current) {
394 if (current.charAt(current.length - 1) != ' ') {
395 current += ' ';
396 }
397 current += className;
398 }
399 else {
400 current = className;
401 }
402 element.className = current;
403}
404function WebForm_RemoveClassName(element, className) {
405 var current = element.className;
406 if (current) {
407 if (current.substring(current.length - className.length - 1, current.length) == ' ' + className) {
408 element.className = current.substring(0, current.length - className.length - 1);
409 return;
410 }
411 if (current == className) {
412 element.className = "";
413 return;
414 }
415 var index = current.indexOf(' ' + className + ' ');
416 if (index != -1) {
417 element.className = current.substring(0, index) + current.substring(index + className.length + 2, current.length);
418 return;
419 }
420 if (current.substring(0, className.length) == className + ' ') {
421 element.className = current.substring(className.length + 1, current.length);
422 }
423 }
424}
425function WebForm_GetElementById(elementId) {
426 if (document.getElementById) {
427 return document.getElementById(elementId);
428 }
429 else if (document.all) {
430 return document.all[elementId];
431 }
432 else return null;
433}
434function WebForm_GetElementByTagName(element, tagName) {
435 var elements = WebForm_GetElementsByTagName(element, tagName);
436 if (elements && elements.length > 0) {
437 return elements[0];
438 }
439 else return null;
440}
441function WebForm_GetElementsByTagName(element, tagName) {
442 if (element && tagName) {
443 if (element.getElementsByTagName) {
444 return element.getElementsByTagName(tagName);
445 }
446 if (element.all && element.all.tags) {
447 return element.all.tags(tagName);
448 }
449 }
450 return null;
451}
452function WebForm_GetElementDir(element) {
453 if (element) {
454 if (element.dir) {
455 return element.dir;
456 }
457 return WebForm_GetElementDir(element.parentNode);
458 }
459 return "ltr";
460}
461function WebForm_GetElementPosition(element) {
462 var result = new Object();
463 result.x = 0;
464 result.y = 0;
465 result.width = 0;
466 result.height = 0;
467 if (element.offsetParent) {
468 result.x = element.offsetLeft;
469 result.y = element.offsetTop;
470 var parent = element.offsetParent;
471 while (parent) {
472 result.x += parent.offsetLeft;
473 result.y += parent.offsetTop;
474 var parentTagName = parent.tagName.toLowerCase();
475 if (parentTagName != "table" &&
476 parentTagName != "body" &&
477 parentTagName != "html" &&
478 parentTagName != "div" &&
479 parent.clientTop &&
480 parent.clientLeft) {
481 result.x += parent.clientLeft;
482 result.y += parent.clientTop;
483 }
484 parent = parent.offsetParent;
485 }
486 }
487 else if (element.left && element.top) {
488 result.x = element.left;
489 result.y = element.top;
490 }
491 else {
492 if (element.x) {
493 result.x = element.x;
494 }
495 if (element.y) {
496 result.y = element.y;
497 }
498 }
499 if (element.offsetWidth && element.offsetHeight) {
500 result.width = element.offsetWidth;
501 result.height = element.offsetHeight;
502 }
503 else if (element.style && element.style.pixelWidth && element.style.pixelHeight) {
504 result.width = element.style.pixelWidth;
505 result.height = element.style.pixelHeight;
506 }
507 return result;
508}
509function WebForm_GetParentByTagName(element, tagName) {
510 var parent = element.parentNode;
511 var upperTagName = tagName.toUpperCase();
512 while (parent && (parent.tagName.toUpperCase() != upperTagName)) {
513 parent = parent.parentNode ? parent.parentNode : parent.parentElement;
514 }
515 return parent;
516}
517function WebForm_SetElementHeight(element, height) {
518 if (element && element.style) {
519 element.style.height = height + "px";
520 }
521}
522function WebForm_SetElementWidth(element, width) {
523 if (element && element.style) {
524 element.style.width = width + "px";
525 }
526}
527function WebForm_SetElementX(element, x) {
528 if (element && element.style) {
529 element.style.left = x + "px";
530 }
531}
532function WebForm_SetElementY(element, y) {
533 if (element && element.style) {
534 element.style.top = y + "px";
535 }
536}
537
</script>
Ok, sorry for the piecemal manner of my answer, but could you try to make 1 more change as shown on the code below:
    requestData.SearchText + "';", True)     <--- remove two double quotes after the semicolon
If Not manager.IsStartupScriptRegistered("setSearchResults") Then
  manager.RegisterStartupScript(Me.GetType, "setSearchResults", "/*Clear Search cookie*/ EkSearch.clrCookie();" + _
    "/*Set search results*/ document.getElementById('" + WebSearch1.ResultTagId + _
    "').innerHTML=""" + WebSearch1.Text.Replace("""", "\\""") + """;" + _
    "/*Set search text box to your text*/ document.getElementById('ecmBasicKeywords').value = '" + _
    requestData.SearchText + "';", True)
End If

Open in new window

Avatar of thedeal56
thedeal56

ASKER

Hello.  After the change to the double quotes, it still gives me the "missing ; before statement" error.  
Avatar of thedeal56
thedeal56

ASKER

Here's a paste from the working version of the code. This one is pasted from the demo (the one with the frames).

//<![CDATA[
3/*Clear Search cookie*/ EkSearch.clrCookie();/*Set search results*/ document.getElementById('__ecmsearchresult$').innerHTML="<table border=0 cellpadding=0 cellspacing=0 width=100% class=t style=\"border-top:1px solid #36c\"><tr><td nowrap><font size=+1>&nbsp;<b>Web</b></font>&nbsp;</td><td align=right nowrap><font size=-1>Results <b>1 </b> - <b> 1 </b> of <b>1</b> for <b>test</b>. (<b>0.33</b> seconds)&nbsp;</font></td></tr></table><p class=g><img src=http://cms.murfreesborotn.gov/CMS400Demo/WorkArea/images/application/HTML.gif alt=''></img>&nbsp;<a class=l href=\"/CMS400Demo/products.aspx?id=336&terms=test\"\">Pocket Guide to Diagnostic Tests(3/13/2006 10:03:23 AM)</a><table cellpadding=0 cellspacing=0 border=0><tr><td class=j><font size=-1>Pocket Guide to Diagnostic Tests. c Tests General Diane Micoll Stephen McPhee Michael Pignone William Detmer Tony Chou Appleton &amp; Lange 19.99 2000-10-31 true This edition of this book is hailed as &quot;a lean, mean reference machine.Journal of Family Practice. This updated, information-rich resource facilita<b>...</b><br><font color=#008000>ID=336 Size=2 KB Last Author=Application Administrator</font></font></td></tr></table>";/*Set search text box to your text*/ document.getElementById('ecmBasicKeywords').value = 'test';
4WebForm_InitCallback();//]]>

Open in new window

Avatar of thedeal56
thedeal56

ASKER

Ah I forgot to take the other line numbers out of my last code paste.  Here is a better one.
//<![CDATA[
/*Clear Search cookie*/ EkSearch.clrCookie();/*Set search results*/ document.getElementById('__ecmsearchresult$').innerHTML="<table border=0 cellpadding=0 cellspacing=0 width=100% class=t style=\"border-top:1px solid #36c\"><tr><td nowrap><font size=+1>&nbsp;<b>Web</b></font>&nbsp;</td><td align=right nowrap><font size=-1>Results <b>1 </b> - <b> 1 </b> of <b>1</b> for <b>test</b>. (<b>0.33</b> seconds)&nbsp;</font></td></tr></table><p class=g><img src=http://cms.murfreesborotn.gov/CMS400Demo/WorkArea/images/application/HTML.gif alt=''></img>&nbsp;<a class=l href=\"/CMS400Demo/products.aspx?id=336&terms=test\"\">Pocket Guide to Diagnostic Tests(3/13/2006 10:03:23 AM)</a><table cellpadding=0 cellspacing=0 border=0><tr><td class=j><font size=-1>Pocket Guide to Diagnostic Tests. c Tests General Diane Micoll Stephen McPhee Michael Pignone William Detmer Tony Chou Appleton &amp; Lange 19.99 2000-10-31 true This edition of this book is hailed as &quot;a lean, mean reference machine.Journal of Family Practice. This updated, information-rich resource facilita<b>...</b><br><font color=#008000>ID=336 Size=2 KB Last Author=Application Administrator</font></font></td></tr></table>";/*Set search text box to your text*/ document.getElementById('ecmBasicKeywords').value = 'test';
WebForm_InitCallback();//]]>

Open in new window

Avatar of thedeal56
thedeal56

ASKER

One thing that I thought was weird, was that on the working version of the code, everything is on 1 line (line 2 in the last post).  On my adaptation, it is split up on multiple lines.  I don't know if that makes a difference, but it just struck me as strange.
Yeah, that's strange. What is WebSearch1, what's supposed to go in there?
Seems like what you have is different from the working code.

I've also noticed in your javascript output there are a lot of \\" sets of characters, which maybe because of the WebSearch1.Text.Replace.
Another thing that you wanna try, remove Replace:

    "').innerHTML=""" + WebSearch1.Text + """;" + _

Open in new window

Avatar of thedeal56
thedeal56

ASKER

I tried removing the replace, and I still got the same error.  I then tried removing the the entire line, leaving it with just
"').innerHTML=""" +  """;" + _
and that produced no error.  It also produced no results, so I searched around for WebSearch1.  I found it in
this:

   


I then switched the ShowSearchBoxAlways value to true, and I was able to see my results.  The only problem now is that I can't search from my search box on my masterpage.  Well, I can search from it, but the result display is not automatic.  I'm posting some pictures so I can better explain it.  

In the Master Page picture, that is were the initial search will entered.  The Search Page is where the search variable will taken in order to display the results.  The problem is on this page, because the variable is being passed to the page, but it's not searching automatically.  The user will have to click the other search button in order to display the results that are shown in the Results picture.  Is there a way to bypass that other submit button?
Master-Page.JPG
Search-Page.JPG
Results.JPG
I suppose concatenating WebSearch1.Text to the innerHTML is the piece of code that wire your search output to be displayed automatically on the Search Page?
Can I trouble you to post the javascript that is produced if you include WebSearch1.Text, but without Replace?
    "').innerHTML=""" + WebSearch1.Text + """;" + _

Open in new window

Avatar of thedeal56
thedeal56

ASKER

Here's the line that it's flagging.  Let me know if you want to see the entire script around it.


/*Clear Search cookie*/ EkSearch.clrCookie();/*Set search results*/ document.getElementById('__ecmsearchresult').innerHTML="<div class="searchResultsHeader"><h3><span class="resultslabel">Results</span> <span class="beginPageCount">1</span> - <span class="endPageCount">10</span> of <span class="totalCount">130</span> for <span class="searchTerms">test</span>.(<span class="searchDuration">8.56</span> seconds)</h3></div><h4>
112

Open in new window

Sigh, I think I mixed up C# and VB. I'm really really sorry :(
Can I trouble you one more time to see if the code below works? It is similar to your very first code, except that I remove the excess double quote after requestData.SearchText (line 6). And notice the single back-slash in WebSearch1.Text.Replace (line 4).
If Not manager.IsStartupScriptRegistered("setSearchResults") Then
  manager.RegisterStartupScript(Me.GetType, "setSearchResults", "/*Clear Search cookie*/ EkSearch.clrCookie();" + _
    "/*Set search results*/ document.getElementById('" + WebSearch1.ResultTagId + _
    "').innerHTML=""" + WebSearch1.Text.Replace("""", "\""") + """;" + _
    "/*Set search text box to your text*/ document.getElementById('ecmBasicKeywords').value = '" + _
    requestData.SearchText + "';", True)
End If

Open in new window

Avatar of thedeal56
thedeal56

ASKER

That brought back the original error:

Unterminated String Literal

I'm attaching the line of code.


There's no need to apologize.  I'm just glad that your taking time out of your day to help me with this.  That's awesome of you.  

/*Clear Search cookie*/ EkSearch.clrCookie();/*Set search results*/ document.getElementById('__ecmsearchresult').innerHTML="<div class=\"searchResultsHeader\"><h3><span class=\"resultslabel\">Results</span> <span class=\"beginPageCount\">1</span> - <span class=\"endPageCount\">10</span> of <span class=\"totalCount\">130</span> for <span class=\"searchTerms\">test</span>.(<span class=\"searchDuration\">2.91</span> seconds)</h3></div><h4>
156

Open in new window

I feel bad for leading you to the wrong direction. Alright, what about this (notice the double replace on line 4):
If Not manager.IsStartupScriptRegistered("setSearchResults") Then
  manager.RegisterStartupScript(Me.GetType, "setSearchResults", "/*Clear Search cookie*/ EkSearch.clrCookie();" + _
    "/*Set search results*/ document.getElementById('" + WebSearch1.ResultTagId + _
    "').innerHTML=""" + WebSearch1.Text.Replace("""", "\""").Replace(vbCrLf, " \ " & vbCrLf) + """;" + _
    "/*Set search text box to your text*/ document.getElementById('ecmBasicKeywords').value = '" + _
    requestData.SearchText + "';", True)
End If

Open in new window

Avatar of thedeal56
thedeal56

ASKER

Here's the same error, Unterminated String Literal, on the attached code.

I thought it was weird that on the original line:

document.getElementById('__ecmsearchresult$')

Vs. my version:

document.getElementById('__ecmsearchresult')

There's no $ after _ecmsearchresult on my line. I don't know if that's a big deal, but it seems like it would be.  
/*Clear Search cookie*/ EkSearch.clrCookie();/*Set search results*/ document.getElementById('__ecmsearchresult').innerHTML="<div class=\"searchResultsHeader\"><h3><span class=\"resultslabel\">Results</span> <span class=\"beginPageCount\">1</span> - <span class=\"endPageCount\">10</span> of <span class=\"totalCount\">130</span> for <span class=\"searchTerms\">test</span>.(<span class=\"searchDuration\">0.73</span> seconds)</h3></div><h4> \

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of philipjonathan
philipjonathan
Flag of New Zealand image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Btw, if after this you get an error message something like object not found, then put back the $ sign as you mentioned in your last post.
Avatar of thedeal56
thedeal56

ASKER

OH my goodness! IT WORKS! That is insanely awesome.  I wish I could give you more than just 500 points.  Thank you very much!
Avatar of thedeal56
thedeal56

ASKER

Thank you so much.
Glad that it works, should have been straightforward, but I made several mistakes a long the way. Glad to help you, have fun coding!
Visual Basic Classic
Visual Basic Classic

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

165K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo