XPage 服务器端验证在 IE8 上不起作用
创建一个简单的“联系我们”XPage。
进行服务器端验证,通过“显示错误”控件显示错误。 有单击时发送电子邮件的按钮。
该功能适用于 Firefox 4.0.1,但不适用于 IE8。
已将以下兼容性代码放入 beforeRenderResponse 事件中:
try {
if (context.getUserAgent().isIE(8, 8)) {
var exCon = facesContext.getExternalContext();
var response = exCon.getResponse();
response.setHeader("X-UA-Compatible", "IE=EmulateIE7");
}
} catch (e) {
}
似乎没有帮助。有什么想法/建议吗?
Derek
更新:
根据要求 - 这是按钮代码:
var doc = database.createDocument();
doc.replaceItemValue("Form", "Memo");
doc.replaceItemValue("Subject", "Contact Us Received");
doc.replaceItemValue("SendTo", "[email protected]");
doc.replaceItemValue("DisplaySent","[email protected]");
//Build Body
var1 = "The following Contact Us message was received: <br><br>";
var2 = var1 + "Contact Name: " + document1.getItemValueString("ContactName").valueOf()+ "<br><br>";
var3 = var2 + "Email Address: " + document1.getItemValueString("ContactEmail").valueOf()+ "<br><br>";
var4 = var3 + "Phone Number: " + document1.getItemValueString("ContactPhone").valueOf() + "<br><br>";
var5 = var4 + "Subject: " + document1.getItemValueString("ContactSubject").valueOf() + "<br><br>";
var6 = var5 + "Message: " + document1.getItemValueString("ContactMessage").valueOf() + "<br>";
body = doc.createMIMEEntity()
stream = session.createStream()
stream.writeText(var6)
body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0)
// Send
doc.send();
context.redirectToPage("Home")
这是生成的 XML:
<xp:button value="Email Test" id="button2">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:var doc = database.createDocument();
doc.replaceItemValue("Form", "Memo");
doc.replaceItemValue("Subject", "Contact Us Received");
doc.replaceItemValue("SendTo", "[email protected]");
doc.replaceItemValue("Princial","[email protected]");
doc.replaceItemValue("ReplyTo","[email protected]");
doc.replaceItemValue("tmpDisplaySentBy","[email protected]");
doc.replaceItemValue("DisplaySent","[email protected]");
doc.replaceItemValue("From","DonahueOnline")
//Build Body
var1 = "The following Contact Us message was received: <br><br>";
var2 = var1 + "Contact Name: " + document1.getItemValueString("ContactName").valueOf()+ "<br><br>";
var3 = var2 + "Email Address: " + document1.getItemValueString("ContactEmail").valueOf()+ "<br><br>";
var4 = var3 + "Phone Number: " + document1.getItemValueString("ContactPhone").valueOf() + "<br><br>";
var5 = var4 + "Subject: " + document1.getItemValueString("ContactSubject").valueOf() + "<br><br>";
var6 = var5 + "Message: " + document1.getItemValueString("ContactMessage").valueOf() + "<br>";
body = doc.createMIMEEntity()
stream = session.createStream()
stream.writeText(var6)
body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0)
// Send
doc.send();
context.redirectToPage("Home")
}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
Derek
============
更新 #2
将代码从按钮移至查询保存事件。相同的结果 - 在 Firefox 中有效,但在 IE8 中无效。假设我有一些基本错误,只是找不到它......这是新的源代码:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.beforeRenderResponse><![CDATA[#{javascript:try {
if (context.getUserAgent().isIE(8, 8)) {
var exCon = facesContext.getExternalContext();
var response = exCon.getResponse();
response.setHeader("X-UA-Compatible", "IE=EmulateIE7");
}
} catch (e) {
}}]]></xp:this.beforeRenderResponse>
<xp:br></xp:br>
<xp:this.data>
<xp:dominoDocument var="document1" formName="CUF">
<xp:this.querySaveDocument><![CDATA[#{javascript:var doc = database.createDocument();
doc.replaceItemValue("Form", "Memo");
doc.replaceItemValue("Subject", "Contact Us Received");
doc.replaceItemValue("SendTo", "[email protected]");
doc.replaceItemValue("Princial","[email protected]");
doc.replaceItemValue("ReplyTo","[email protected]");
doc.replaceItemValue("tmpDisplaySentBy","[email protected]");
doc.replaceItemValue("DisplaySent","[email protected]");
doc.replaceItemValue("From","DonahueOnline")
//Build Body
var1 = "The following Contact Us message was received: <br><br>";
var2 = var1 + "Contact Name: " + document1.getItemValueString("ContactName").valueOf()+ "<br><br>";
var3 = var2 + "Email Address: " + document1.getItemValueString("ContactEmail").valueOf()+ "<br><br>";
var4 = var3 + "Phone Number: " + document1.getItemValueString("ContactPhone").valueOf() + "<br><br>";
var5 = var4 + "Subject: " + document1.getItemValueString("ContactSubject").valueOf() + "<br><br>";
var6 = var5 + "Message: " + document1.getItemValueString("ContactMessage").valueOf() + "<br>";
body = doc.createMIMEEntity()
stream = session.createStream()
stream.writeText(var6)
body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0)
// Send
doc.send();
context.redirectToPage("Home")
}]]></xp:this.querySaveDocument></xp:dominoDocument>
</xp:this.data>
<xp:table
style="margin-top:5.0px;margin-bottom:5.0px;padding-top:5.0px;padding-bottom:5.0px">
<xp:tr>
<xp:td>
<xp:span style="font-size:16pt">Contact Us</xp:span>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td></xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">
* (denotes required field)
</xp:td>
</xp:tr>
<xp:tr>
<xp:td></xp:td>
</xp:tr>
<xp:tr>
<xp:td style="width:400px;font-size:12pt">
Name:*
<xp:message id="ContactNameError" for="ContactName"
style="color:rgb(255,128,128);font-size:9pt">
</xp:message>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputText id="ContactName"
value="#{document1.ContactName}" style="width:200px"
required="true">
<xp:this.validators>
<xp:validateRequired
message="Name is required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
<xp:br></xp:br>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">
Email Address:*  
<xp:message id="message1"
style="color:rgb(255,0,0);font-size:9pt" for="ContactEmail">
</xp:message>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputText id="ContactEmail" style="width:200px"
value="#{document1.ContactEmail}" required="true">
<xp:this.validators>
<xp:validateRequired
message="Email Address is Required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">Phone Number:</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputText id="ContactPhone" style="width:200px"
value="#{document1.ContactPhone}" required="true">
<xp:this.validators>
<xp:validateRequired
message="Phone Number is Required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
<xp:br></xp:br>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">
Subject:*  
<xp:message id="message2"
style="color:rgb(255,0,0);font-size:9pt" for="ContactSubject">
</xp:message>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputText id="ContactSubject" style="width:300px"
value="#{document1.ContactSubject}" required="true">
<xp:this.validators>
<xp:validateRequired
message="Subject is required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">
Message:*  
<xp:message id="message3"
style="color:rgb(255,0,0);font-size:9pt" for="ContactMessage">
</xp:message>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputTextarea id="ContactMessage"
style="height:250px;width:99%" value="#{document1.ContactMessage}"
required="true">
<xp:this.validators>
<xp:validateRequired
message="A message is required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputTextarea>
</xp:td>
</xp:tr>
</xp:table>
<xp:br></xp:br>
<xp:button value="Submit" id="button1"><xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action>
<xp:saveDocument var="document1"></xp:saveDocument>
</xp:this.action></xp:eventHandler></xp:button></xp:view>
==========
更新#3
尝试了发布的建议。删除了设置IE8兼容模式的代码。重新做了按钮。在按钮代码中包含 save="false"。仍然可以在 FireFox 中使用,但不能在 IE8 中使用。 IE8 显示页面,但验证和电子邮件代码不运行...奇怪...
这是最新的源代码:
<xp:br></xp:br>
<xp:this.data>
<xp:dominoDocument var="document1" formName="CUF">
<xp:this.querySaveDocument><![CDATA[#{javascript:var doc = database.createDocument();
doc.replaceItemValue("表单", "备忘录"); doc.replaceItemValue("主题", "联系我们已收到"); doc.replaceItemValue("SendTo", "[电子邮件受保护]"); doc.replaceItemValue("Princial","[电子邮件受保护]"); doc.replaceItemValue("ReplyTo","[电子邮件受保护]"); doc.replaceItemValue("tmpDisplaySentBy","[电子邮件受保护]"); doc.replaceItemValue("DisplaySent","[电子邮件受保护]"); doc.replaceItemValue("From","DonahueOnline")
//构建主体 var1 = "收到以下联系我们消息:
"; var2 = var1 + "联系人姓名:" + document1.getItemValueString("联系人姓名").valueOf()+ "
"; var3 = var2 + "电子邮件地址:" + document1.getItemValueString("联系人电子邮件").valueOf()+ "
"; var4 = var3 + "电话号码:" + document1.getItemValueString("联系电话").valueOf() + "
"; var5 = var4 + "主题:" + document1.getItemValueString("ContactSubject").valueOf() + "
"; var6 = var5 + "消息:" + document1.getItemValueString("ContactMessage").valueOf() + "
";
正文 = doc.createMIMEEntity() 流 = session.createStream() 流.writeText(var6) body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0)
// 发送 文档.发送(); context.redirectToPage("首页")
}]]> 联系我们 *(表示必填字段) 姓名:*
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputText id="ContactName"
value="#{document1.ContactName}" style="width:200px"
required="true">
<xp:this.validators>
<xp:validateRequired
message="Name is required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
<xp:br></xp:br>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">
Email Address:*  
<xp:message id="message1"
style="color:rgb(255,0,0);font-size:9pt" for="ContactEmail">
</xp:message>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputText id="ContactEmail" style="width:200px"
value="#{document1.ContactEmail}" required="true">
<xp:this.validators>
<xp:validateRequired
message="Email Address is Required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">Phone Number:</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputText id="ContactPhone" style="width:200px"
value="#{document1.ContactPhone}" required="true">
<xp:this.validators>
<xp:validateRequired
message="Phone Number is Required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
<xp:br></xp:br>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">
Subject:*  
<xp:message id="message2"
style="color:rgb(255,0,0);font-size:9pt" for="ContactSubject">
</xp:message>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputText id="ContactSubject" style="width:300px"
value="#{document1.ContactSubject}" required="true">
<xp:this.validators>
<xp:validateRequired
message="Subject is required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">
Message:*  
<xp:message id="message3"
style="color:rgb(255,0,0);font-size:9pt" for="ContactMessage">
</xp:message>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputTextarea id="ContactMessage"
style="height:250px;width:99%" value="#{document1.ContactMessage}"
required="true">
<xp:this.validators>
<xp:validateRequired
message="A message is required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputTextarea>
</xp:td>
</xp:tr>
</xp:table>
<xp:br></xp:br>
<xp:button value="Label" id="button1">
<xp:eventHandler event="onclick" submit="true" save="false" refreshMode="complete">
<xp:this.action>
<xp:saveDocument var="document1"></xp:saveDocument>
</xp:this.action>
Have a simple "contact us" XPage created.
Have server side validation in place that displays errors via 'Display Error' controls.
Have button that sends out email when clicked.
Functionality works using Firefox 4.0.1, but does not with IE8.
Have put the following compatibility code in the beforeRenderResponse event:
try {
if (context.getUserAgent().isIE(8, 8)) {
var exCon = facesContext.getExternalContext();
var response = exCon.getResponse();
response.setHeader("X-UA-Compatible", "IE=EmulateIE7");
}
} catch (e) {
}
Does not seem to help. Any ideas/suggestions?
Derek
Update:
As requested - here's the button code:
var doc = database.createDocument();
doc.replaceItemValue("Form", "Memo");
doc.replaceItemValue("Subject", "Contact Us Received");
doc.replaceItemValue("SendTo", "[email protected]");
doc.replaceItemValue("DisplaySent","[email protected]");
//Build Body
var1 = "The following Contact Us message was received: <br><br>";
var2 = var1 + "Contact Name: " + document1.getItemValueString("ContactName").valueOf()+ "<br><br>";
var3 = var2 + "Email Address: " + document1.getItemValueString("ContactEmail").valueOf()+ "<br><br>";
var4 = var3 + "Phone Number: " + document1.getItemValueString("ContactPhone").valueOf() + "<br><br>";
var5 = var4 + "Subject: " + document1.getItemValueString("ContactSubject").valueOf() + "<br><br>";
var6 = var5 + "Message: " + document1.getItemValueString("ContactMessage").valueOf() + "<br>";
body = doc.createMIMEEntity()
stream = session.createStream()
stream.writeText(var6)
body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0)
// Send
doc.send();
context.redirectToPage("Home")
Here's the XML generated:
<xp:button value="Email Test" id="button2">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:var doc = database.createDocument();
doc.replaceItemValue("Form", "Memo");
doc.replaceItemValue("Subject", "Contact Us Received");
doc.replaceItemValue("SendTo", "[email protected]");
doc.replaceItemValue("Princial","[email protected]");
doc.replaceItemValue("ReplyTo","[email protected]");
doc.replaceItemValue("tmpDisplaySentBy","[email protected]");
doc.replaceItemValue("DisplaySent","[email protected]");
doc.replaceItemValue("From","DonahueOnline")
//Build Body
var1 = "The following Contact Us message was received: <br><br>";
var2 = var1 + "Contact Name: " + document1.getItemValueString("ContactName").valueOf()+ "<br><br>";
var3 = var2 + "Email Address: " + document1.getItemValueString("ContactEmail").valueOf()+ "<br><br>";
var4 = var3 + "Phone Number: " + document1.getItemValueString("ContactPhone").valueOf() + "<br><br>";
var5 = var4 + "Subject: " + document1.getItemValueString("ContactSubject").valueOf() + "<br><br>";
var6 = var5 + "Message: " + document1.getItemValueString("ContactMessage").valueOf() + "<br>";
body = doc.createMIMEEntity()
stream = session.createStream()
stream.writeText(var6)
body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0)
// Send
doc.send();
context.redirectToPage("Home")
}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
Derek
============
Update #2
Moved the code from the button to the query save event. Same result - works in Firefox, but not IE8. Assume I have something basic wrong, just can't find it... Here is new source code:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.beforeRenderResponse><![CDATA[#{javascript:try {
if (context.getUserAgent().isIE(8, 8)) {
var exCon = facesContext.getExternalContext();
var response = exCon.getResponse();
response.setHeader("X-UA-Compatible", "IE=EmulateIE7");
}
} catch (e) {
}}]]></xp:this.beforeRenderResponse>
<xp:br></xp:br>
<xp:this.data>
<xp:dominoDocument var="document1" formName="CUF">
<xp:this.querySaveDocument><![CDATA[#{javascript:var doc = database.createDocument();
doc.replaceItemValue("Form", "Memo");
doc.replaceItemValue("Subject", "Contact Us Received");
doc.replaceItemValue("SendTo", "[email protected]");
doc.replaceItemValue("Princial","[email protected]");
doc.replaceItemValue("ReplyTo","[email protected]");
doc.replaceItemValue("tmpDisplaySentBy","[email protected]");
doc.replaceItemValue("DisplaySent","[email protected]");
doc.replaceItemValue("From","DonahueOnline")
//Build Body
var1 = "The following Contact Us message was received: <br><br>";
var2 = var1 + "Contact Name: " + document1.getItemValueString("ContactName").valueOf()+ "<br><br>";
var3 = var2 + "Email Address: " + document1.getItemValueString("ContactEmail").valueOf()+ "<br><br>";
var4 = var3 + "Phone Number: " + document1.getItemValueString("ContactPhone").valueOf() + "<br><br>";
var5 = var4 + "Subject: " + document1.getItemValueString("ContactSubject").valueOf() + "<br><br>";
var6 = var5 + "Message: " + document1.getItemValueString("ContactMessage").valueOf() + "<br>";
body = doc.createMIMEEntity()
stream = session.createStream()
stream.writeText(var6)
body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0)
// Send
doc.send();
context.redirectToPage("Home")
}]]></xp:this.querySaveDocument></xp:dominoDocument>
</xp:this.data>
<xp:table
style="margin-top:5.0px;margin-bottom:5.0px;padding-top:5.0px;padding-bottom:5.0px">
<xp:tr>
<xp:td>
<xp:span style="font-size:16pt">Contact Us</xp:span>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td></xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">
* (denotes required field)
</xp:td>
</xp:tr>
<xp:tr>
<xp:td></xp:td>
</xp:tr>
<xp:tr>
<xp:td style="width:400px;font-size:12pt">
Name:*
<xp:message id="ContactNameError" for="ContactName"
style="color:rgb(255,128,128);font-size:9pt">
</xp:message>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputText id="ContactName"
value="#{document1.ContactName}" style="width:200px"
required="true">
<xp:this.validators>
<xp:validateRequired
message="Name is required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
<xp:br></xp:br>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">
Email Address:*
<xp:message id="message1"
style="color:rgb(255,0,0);font-size:9pt" for="ContactEmail">
</xp:message>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputText id="ContactEmail" style="width:200px"
value="#{document1.ContactEmail}" required="true">
<xp:this.validators>
<xp:validateRequired
message="Email Address is Required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">Phone Number:</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputText id="ContactPhone" style="width:200px"
value="#{document1.ContactPhone}" required="true">
<xp:this.validators>
<xp:validateRequired
message="Phone Number is Required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
<xp:br></xp:br>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">
Subject:*
<xp:message id="message2"
style="color:rgb(255,0,0);font-size:9pt" for="ContactSubject">
</xp:message>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputText id="ContactSubject" style="width:300px"
value="#{document1.ContactSubject}" required="true">
<xp:this.validators>
<xp:validateRequired
message="Subject is required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">
Message:*
<xp:message id="message3"
style="color:rgb(255,0,0);font-size:9pt" for="ContactMessage">
</xp:message>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputTextarea id="ContactMessage"
style="height:250px;width:99%" value="#{document1.ContactMessage}"
required="true">
<xp:this.validators>
<xp:validateRequired
message="A message is required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputTextarea>
</xp:td>
</xp:tr>
</xp:table>
<xp:br></xp:br>
<xp:button value="Submit" id="button1"><xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action>
<xp:saveDocument var="document1"></xp:saveDocument>
</xp:this.action></xp:eventHandler></xp:button></xp:view>
==========
UPDATE #3
Tried the suggestions posted. Removed the code that set compatibility mode of IE8. Re-did the button. Included save="false" in the button code. Still works in FireFox, but not with IE8. IE8 displays page, but validation and email code does not run... odd...
Here is latest source code:
<xp:br></xp:br>
<xp:this.data>
<xp:dominoDocument var="document1" formName="CUF">
<xp:this.querySaveDocument><![CDATA[#{javascript:var doc = database.createDocument();
doc.replaceItemValue("Form", "Memo");
doc.replaceItemValue("Subject", "Contact Us Received");
doc.replaceItemValue("SendTo", "[email protected]");
doc.replaceItemValue("Princial","[email protected]");
doc.replaceItemValue("ReplyTo","[email protected]");
doc.replaceItemValue("tmpDisplaySentBy","[email protected]");
doc.replaceItemValue("DisplaySent","[email protected]");
doc.replaceItemValue("From","DonahueOnline")
//Build Body
var1 = "The following Contact Us message was received:
";
var2 = var1 + "Contact Name: " + document1.getItemValueString("ContactName").valueOf()+ "
";
var3 = var2 + "Email Address: " + document1.getItemValueString("ContactEmail").valueOf()+ "
";
var4 = var3 + "Phone Number: " + document1.getItemValueString("ContactPhone").valueOf() + "
";
var5 = var4 + "Subject: " + document1.getItemValueString("ContactSubject").valueOf() + "
";
var6 = var5 + "Message: " + document1.getItemValueString("ContactMessage").valueOf() + "
";
body = doc.createMIMEEntity()
stream = session.createStream()
stream.writeText(var6)
body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0)
// Send
doc.send();
context.redirectToPage("Home")
}]]>
Contact Us
* (denotes required field)
Name:*
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputText id="ContactName"
value="#{document1.ContactName}" style="width:200px"
required="true">
<xp:this.validators>
<xp:validateRequired
message="Name is required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
<xp:br></xp:br>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">
Email Address:*
<xp:message id="message1"
style="color:rgb(255,0,0);font-size:9pt" for="ContactEmail">
</xp:message>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputText id="ContactEmail" style="width:200px"
value="#{document1.ContactEmail}" required="true">
<xp:this.validators>
<xp:validateRequired
message="Email Address is Required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">Phone Number:</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputText id="ContactPhone" style="width:200px"
value="#{document1.ContactPhone}" required="true">
<xp:this.validators>
<xp:validateRequired
message="Phone Number is Required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
<xp:br></xp:br>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">
Subject:*
<xp:message id="message2"
style="color:rgb(255,0,0);font-size:9pt" for="ContactSubject">
</xp:message>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputText id="ContactSubject" style="width:300px"
value="#{document1.ContactSubject}" required="true">
<xp:this.validators>
<xp:validateRequired
message="Subject is required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="font-size:12pt">
Message:*
<xp:message id="message3"
style="color:rgb(255,0,0);font-size:9pt" for="ContactMessage">
</xp:message>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:inputTextarea id="ContactMessage"
style="height:250px;width:99%" value="#{document1.ContactMessage}"
required="true">
<xp:this.validators>
<xp:validateRequired
message="A message is required.">
</xp:validateRequired>
</xp:this.validators>
</xp:inputTextarea>
</xp:td>
</xp:tr>
</xp:table>
<xp:br></xp:br>
<xp:button value="Label" id="button1">
<xp:eventHandler event="onclick" submit="true" save="false" refreshMode="complete">
<xp:this.action>
<xp:saveDocument var="document1"></xp:saveDocument>
</xp:this.action>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果没有实际的代码,就很难诊断问题。这可能与未设置正确的按钮类型有关,该按钮类型在 Firefox 中有效,但会破坏 IE。请参阅我写的这篇博客文章:
http://blog.thimojansenit.nl/2011/06/fix-default-type-for-submit-buttons-in.html
(编辑)在这种情况下,看到代码后,尝试使用'save="false"' 添加到事件处理程序中。像这样:
对我来说,当 IE 在提交事件上的行为与 Firefox 不同时,这会起作用。
Without the actual code it's hard to diagnose the problem. It might be related to not setting the correct button type, which works in Firefox, but breaks IE. See this blog post I wrote about that:
http://blog.thimojansenit.nl/2011/06/fix-default-type-for-submit-buttons-in.html
(edit) In this case, after seeing the code, try it with 'save="false"' added to the eventHandler. Like this:
For me this does the trick when IE is not behaving the same as Firefox on a submit event.
您的代码不应该在按钮中。将按钮设置为“提交”并将代码移动到数据源的 querysave 事件。
Your code shouldn't be in the button. Set the button to be type 'submit and move your code to the querysave event of your data source.
为什么要模拟ie7?如果您有 8.5.3 服务器,请使用 ie8 标准或 9(如果可能)。 ie7不好。
Why are you emulating ie7? If you have a 8.5.3 server use ie8 standards or 9 if possible. ie7 is not good.