I have a contact form where I use the email bean found on OpenNTF snippets to send the email out. That part works great.
Once the email is sent, I am showing a dialogbox with a little message to let the user know that the message was sent. What I would like to do, and can't figure out, is to redirect the user to the homepage once he hits the close button on the dialog.
Here's the code in the button:
<xp:button id="button1" value="Send">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:try{
//var sendTo = document1.getItemValueString("SendTo");
var sendTo = AppConfig.getAppEmailAddress();
//var subject = document1.getItemValueString("Subject");
var subject = "Belair Docum: " + document1.getItemValueString("category") + " - " + document1.getItemValueString("Subject");
//var senderEmail = "noreply@belairdirect.com";
var senderName = userBean.abbreviatedName;
emailBean.setSendTo(sendTo);
emailBean.setSubject(subject);
emailBean.setSenderEmail(senderName);
emailBean.setSenderName(senderName);
emailBean.setDocument(document1);
emailBean.setFieldName("Body");
emailBean.setBannerHTML("<p>Email sent from belair Docum 2.0</p><hr>");
//emailBean.setFooterHTML("<hr><p>Email sent from belair Docum 2.0</p>");
emailBean.send();
var d = getComponent('dialog1');
d.show();
}catch(e){
print(e.getMessage());
}}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
I tried to put this in the Dialog's Dojo onClose event, but it doesn't work:
window.location.pathname = "/home.xsp"
Can it be a refresh issue, or I am not using the proper event, or I need to use different code?
Thanks :D