How to close a glide overlay window with onclick function.

cwmurphy
Mega Expert

I've created a button for end users to select a shipping method for purchase requests.   A glide overlay window pops up and gives them their choices.   Once they make a selection, there is a button called "Ship It" that they click.   I would like this button to close the glide overlay window.   So far, every attempt has been unsuccessful.   Does anyone know what I would put in my UI Page function to get this window to close one they click the "Ship It" button?  

18 REPLIES 18

cwmurphy
Mega Expert

Here is the code I'm using for the UI Page:



HTML:


<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">






<div style="width:320px; text-align:center; border:2px solid white">


<p>Please select your requested Shipping Method:</p>


</div><br></br>




<div style="width: 320px; text-align:center">


<input type="radio" onclick="flynn()" name="shipping" value="UPS Ground" id="better">UPS Ground


</input><br><br>


<input type="radio" onclick="skyler()" name="shipping" value="Two Day Air" id="call">Two Day Air


</input><br><br>


<input type="radio" onclick="walter()" name="shipping" value="Overnight" id="saul">Overnight


</input>


</br>


</br>


</br>


</br>


</div>








<div style="width:320px; text-align:center">


<button id="ozymandias" onclick="mike(felina())" name="ship it" type="button" value="Ship It!">Ship It!</button>


</div><br></br>




<div style="width:320px; text-align:center; font size=2; color:red; border:2px dashed grey">


<p>DUE TO CERTAIN RESTRICTIONS, COST, OR AVAILABILITY, YOUR ITEM MAY NOT SHIP IN THE MANNER REQUESTED.   THIS IS ONLY A REQUEST.</p>


</div>






</j:jelly>





Client Script:


//Disallows the user to select more than one choice at a time for Shipping Type.


function flynn(){


  var hank = document.getElementById ("call").checked = false;


  var marie = document.getElementById ("saul").checked = false;


}


function skyler(){


  var jesse = document.getElementById ("better").checked = false;


  var saul = document.getElementById ("saul").checked = false;


}


function walter(){


  var gomez = document.getElementById ("better").checked = false;


  var gus = document.getElementById ("call").checked = false;


}




//Selects the Shipping Method


function mike(){



  if(document.getElementById('better').checked == true){


  var grayMatter = gel("better").value;


  g_form.setValue('select_shipping', grayMatter);



}


  else if(document.getElementById('call').checked == true){


  var grilled = gel("call").value;


  g_form.setValue('select_shipping', grilled);    



}


  else if(document.getElementById('saul').checked == true){


  var breakage = gel("saul").value;


  g_form.setValue('select_shipping', breakage);



  }


}




//Closes Shipping Selection window - CURRENTLY NOT WORKING


function felina(){


  alert('this should have closed the window');


}









This is the code in the UI Macro:



Script to show the button in the cart:


<tr>


    <td colspan="2" class="order_buttons">


  <a class="request_catalog_button_with_icon" href="#" id="shipping_options" onclick="if ($$('.order_buttons .disabled_order_button').length == 0) { shippingOptions(); } else { alert('${gs.getMessage('This option is for Purchase Items only.')}'); } return false;" title="${gs.getMessage('Shipping Options)}">


  <table><tr><td>


                                                                                              <img src="ShippingOptions4.png" width="20" height="14"/>


                                                                                              </td><td class="text_cell">


  ${gs.getMessage('Shipping Options')}


  </td></tr></table>


  </a>


    </td>


  </tr>









Function to populate the Popup Box:



function shippingOptions() {


  var huell = new GlideOverlay({


                        title: 'Shipping Options',


                        form: 'shipping_options',


                                  height: 370,


                                  width: 340




                        });


                                       


                        huell.render();






}


change like this and may be it will usefull.



function shippingOptions() {


  var huell = new GlideOverlay({


                        title: 'Shipping Options',


                        form: 'shipping_options',


                                  height: 370,


                                  width: 340


        });


                                       


                        huell.render();


return false;


}




after this, in


function felina(){


/// try to destroy here by glidedialogwindow().get.destroy()


  alert('this should have closed the window');


}





Try this, may be it will work


Tested this as well.   The box does not close.   Also, the alert in function felina() does not show.  


Try to call felina() function inside mike() function at the very last.


Code here is showing that it's already pulling function felina() within function mike()




<div style="width:320px; text-align:center">


<button id="ozymandias" onclick="mike(felina())" name="ship it" type="button" value="Ship It!">Ship It!</button>


</div><br></br>