Don't worry - I just sorted it out. It's because I'm using a button type of IMAGE
instead of SUBMIT. When I changed the type
property to SUBMIT, it worked fine and the window closed itself.
However...now I have to use a kludgy-looking grey button instead of my super-funky
graphic. Can ND fix this please and
allow use of type=image with JavaScript's onClick="window.close()"?
Cheers,
Pete
[EMAIL PROTECTED] wrote:
>Hi Larry,>
>I'm having exactly the same problem: window.close() will only clear the contents of
>the window; it won't actually close it.
>This has never been a problem doing straight JavaScript and HTML, but it doesn't
>function the same way in the ND
>environment.
>
>Did you come up with an alternative solution? Anyone have any ideas?
>
>Thanks,
>Pete
>
>
>
>[EMAIL PROTECTED] wrote:
>>Hello Nanda,>
>>Your suggestion almost worked, I added a ND button and added this code. When I run
>it and after
>>pressing the button, this window will clear itself ( meaning.. make all the fields
>disappear)... it does
>>not close itself.
>>
>>//[[SPIDER_EVENT<Button1_onWebEvent>
>> public int Button1_onWebEvent(CSpWebEvent event)
>> {
>> int command = PROCEED;
>>
>> CSpHttp test = new CSpHttp();
>> test.write("<script
>language=\"JavaScript\">top.opener.close();</script>");
>>
>> //command = doAction(event);
>> return(command);
>> }
>> //]]SPIDER_EVENT<Button1_onWebEvent>
>>
>>
>>I don't know if I have the right code or not... And I also tried these methods:
>> window.close()
>> self.close()
>> close()
>> top.opener.close()
>>
>>They all do the same thing.
>>
>>Do you have any other suggestions?
>>
>>Thanks in Advance
>>Larry
>>
>>
>>
>>
>>"Nanda Palani" <[EMAIL PROTECTED]> wrote:
>>>If you open the second window using Javascript open(), you can do the >foll:
>>>Have the BackToGame button as an ND button, do whetever you want in ND
>>>on the click of this button, then grab the http outputstream (CSpHttp),
>>>and simply send out
>>>
>>>"<script language=\"JavaScript\">window.close();</script>". This should
>>>close the second window.
>>>
>>>-Nanda Palani
>>>
>>>>
>>>>Maybe JavaScript has a get function which can synchronously get the
>>>html for
>>>>a url. This would be nice and simple.
>>>>
>>>>How about creating a new temporary window with the right url to cause
>>>to the
>>>>next event processing to occur, then closing the new window.
>>>>
>>>>You could maybe put a message in the windows then set its location to
>>>be the
>>>>processing url.
>>>>
>>>>If you close the new temporary window straight away, it will not have
>>>had
>>>>time to hit the server.
>>>>
>>>>The new windows will have to close itself as a return from the
>>>processing
>>>>url as otherwise you will have no idea weather the processing is
>>>completed.
>>>>
>>>>It seems to me that the back to game button on the last window could be
>>>a
>>>>NetDynamics button which returned a page with the right Java script to
>>>get
>>>>back to the game. This might be a better design.
>>>>
>>>>Brendan Johnston
>>>>[EMAIL PROTECTED] (w)
>>>>[EMAIL PROTECTED] (h)
>>>>(909) 394 - 8639
>>>>Team NetDynamics
>>>>
>>>>
>>>>> ----------
>>>>> From: Curt Springer[SMTP:[EMAIL PROTECTED]]
>>>>> Sent: Tuesday, November 17, 1998 10:47 AM
>>>>> To: [EMAIL PROTECTED]
>>>>> Subject: Re: [ND] Calling an ND event from HTML java script function
>>>>>
>>>>> I might not be the best one to respond, knowing close to squat about
>>>>> javascript in any detail.
>>>>>
>>>>> I see that your 'goback' method is defining a string to be the name
>>>of the
>>>>> of the 'next' method. But I don't see whether or how the 'submit()'
>>>makes
>>>>> use of this string in constructing the URL that is sent back. And it
>>>>> appears that indeed the method name is not being sent back, as the
>>>>> 'this_onBeforeLoadEvent' is run whenever you send a url that contains
>>>a
>>>>> page name but no method name (as when you type a standard ND URL in
>>>your
>>>>> browser to start a session in an ND app).
>>>>>
>>>>> -- Curt
>>>>>
>>>>> At 10:05 AM 11/17/98 -0800, [EMAIL PROTECTED] wrote:
>>>>> >Hello,
>>>>> >
>>>>> >I am new to ND 4 and using NetScape 4.
>>>>> >
>>>>> >I have an ND page that was opened from javascript using this method:
>>>>> >
>>>>> window.open("../GameBoard/pgQuestion?row=3&col=6&SPIDERSESSION=" +
>>>>> s_session,"Square","height=400,width=600,left=200,top=150")
>>>>> >
>>>>> >
>>>>> >Now once that window is opened, I have 2 buttons on it a NEXT button
>>>and
>>>>> a
>>>>> BackToGame button.
>>>>> >The NEXT button goes through the questions/answers and saves each
>>>record
>>>>> to the DB. When the user is
>>>>> >done going through all the questions, they can close the window by
>>>>> clicking on BackToGame .
>>>>> >
>>>>> >The problem is the last record will not get saved unless they click
>>>the
>>>>> NEXT button, So I want the
>>>>> >BackToGame button to call the NEXT button event and then close the
>>>>> window. That would be
>>>>> >easy IF the BackToGame button was a ND button... it is not... it is
>>>a
>>>>> java script button.
>>>>> >
>>>>> >I have read the other messages related to this question but can not
>>>>> figure
>>>>> it out... this is what I have so
>>>>> >far:
>>>>> >
>>>>> >// ****************** this is the html that has the NEXT button and
>>>the
>>>>> BackToGame button
>>>>> >
>>>>> ><BR>
>>>>> ><Table BORDER=0 CELLSPACING=2 CELLPADDING=2 WIDTH=100%>
>>>>> ><tr>
>>>>> ><td ALIGN=LEFT WIDTH=15%>**Next**</td>
>>>>> ><td ALIGN=RIGHT WIDTH=25%>Question #</td>
>>>>> ><td ALIGN=LEFT WIDTH=20%>**question_question_number**</td>
>>>>> ><td ALIGN=RIGHT WIDTH=40%><INPUT TYPE="button" NAME="pbGoBack"
>>>>> VALUE="Back
>>>>> to Game"
>>>>> > onclick=goBack()></td>
>>>>> > <!-- onclick=window.close()></td> -->
>>>>> ></tr>
>>>>> ></table>
>>>>> >
>>>>> >
>>>>> ><SCRIPT LANGUAGE=JavaScript>
>>>>> >
>>>>> >function goBack() {
>>>>> >
>>>>> > this.document.forms[0].pbGoBack.name
>>>="Next_onWebEvent(Next)";
>>>>> > this.document.forms[0].submit();
>>>>> > window.close();
>>>>> >}
>>>>> >
>>>>> ></script>
>>>>> >
>>>>> >
>>>>> >
>>>>> >//********************************* this is the ND page event for
>>>the
>>>>> NEXT
>>>>> button
>>>>> >
>>>>> >//[[SPIDER_EVENT<Next_onWebEvent>
>>>>> > public int Next_onWebEvent(CSpWebEvent event)
>>>>> > {
>>>>> > int command = PROCEED;
>>>>> >
>>>>> > CSpMultiSQL sqlInsert = (CSpMultiSQL)
>>>>> CSpider.getDataObject("doSaveAnswer");
>>>>> > sqlInsert.clearAllValues();
>>>>> >
>>>>> >
>>>>>
>>>sqlInsert.setValue("answer_question_id",getDisplayFieldValue("question_que
>>>>> st
>>>>> ion_id"));
>>>>> >
>>>>>
>>>sqlInsert.setValue("answer_area_id",getDisplayFieldValue("question_area_id
>>>>> "));
>>>>> >
>>>>>
>>>sqlInsert.setValue("answer_industry_id",CSpider.getUserSessionObject("INDU
>>>>> ST
>>>>> RY_ID"));
>>>>> >
>>>>>
>>>sqlInsert.setValue("answer_company_id",CSpider.getUserSessionObject("COMPA
>>>>> NY
>>>>> _ID"));
>>>>> >
>>>>> sqlInsert.setValue("answer_yes_no",getDisplayFieldValue("cmbYesNo"));
>>>>> >
>>>>>
>>>sqlInsert.setValue("answer_importance",getDisplayFieldValue("cmbImportance
>>>>> "));
>>>>> >
>>>>>
>>>sqlInsert.setValue("answer_satisfaction",getDisplayFieldValue("cmbSatisfic
>>>>> at
>>>>> ion"));
>>>>> >
>>>>> > sqlInsert.executeInsert();
>>>>> >
>>>>> > if (!sqlInsert.succeeded()) {
>>>>> > // Prepare the message page
>>>>> > CSpPage nextPage = new CSpPage();
>>>>> > nextPage.setDisplayFieldValue("stMessage", new
>>>>> CSpString("Saving Answer
>>>>> Failed."));
>>>>> > nextPage.putPageSessionObject("NEXTPAGE", new
>>>>> CSpString("pgMessage"));
>>>>> > return(nextPage.load(false));
>>>>> > }
>>>>> > command = doAction(event);
>>>>> > return(command);
>>>>> > }
>>>>> > //]]SPIDER_EVENT<Next_onWebEvent>
>>>>> >
>>>>> >
>>>>> >
>>>>> >//**************************
>>>>> >//***************************
>>>>> >
>>>>> >when I run it, it does not save to DB and I get an error in the
>>>>> >
>>>>> > //[[SPIDER_EVENT<this_onBeforeLoadEvent>
>>>>> > public int this_onBeforeLoadEvent(CSpPageEvent event)
>>>>> >
>>>>> >Why would I ND be going in this event when I want to close the
>>>window??
>>>>> >
>>>>> >
>>>>> >THANKS for your HELP!!!
>>>>> >
>>>>> >Larry
>>>>>
>>>>_________________________________________________________________________
>>>>> >
>>>>> >For help in using, subscribing, and unsubscribing to the discussion
>>>>> >forums, please go to: http://www.netdynamics.com/support/#forums
>>>>> >
>>>>> >For dire need help, email: [EMAIL PROTECTED]
>>>>> >
>>>>>
>>>__________________________________________________________________________
>>>>> ___
>>>>> Curt Springer English or French -
>>>your
>>>>> choice
>>>>> Team NetDynamics En francais ou en anglais - c'est � toi de
>>>>> choisir
>>>>> �quipe NetDynamics
>>>>>
>>>>>
>>>_________________________________________________________________________
>>>>>
>>>>> For help in using, subscribing, and unsubscribing to the discussion
>>>>> forums, please go to: http://www.netdynamics.com/support/#forums
>>>>>
>>>>> For dire need help, email: [EMAIL PROTECTED]
>>>>>
>>>>_________________________________________________________________________
>>>>
>>>>For help in using, subscribing, and unsubscribing to the discussion
>>>>forums, please go to: http://www.netdynamics.com/support/#forums
>>>>
>>>>For dire need help, email: [EMAIL PROTECTED]
>>>>
>>>
>>>
>>>______________________________________________________
>>>Get Your Private, Free Email at http://www.hotmail.com
>>
>
_________________________________________________________________________
For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
For dire need help, email: [EMAIL PROTECTED]