Xpages Form to Submit Record and Cookie (xpsubscription.xsp)

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
	style="background-color:rgb(192,192,192)">
	<xp:span style="font-weight:bold;font-size:18pt">
		Subscription
	</xp:span>
	<xp:span style="font-weight:bold;font-size:18pt">Page</xp:span>
	<xp:br style="font-weight:bold;font-size:18pt"></xp:br>

<xp:table style="width:593.0px">

			<xp:tr>
				<xp:td>
					<xp:inputText id="firstName1" required="true" value="#{SendSubscriptionJavaBean.firstName}">
						<xp:this.validators>
							<xp:validateRequired
								message="FirstName Required">
							</xp:validateRequired>
						</xp:this.validators></xp:inputText>
					<xp:br></xp:br><xp:message for="firstName1" />
				</xp:td>
				<xp:td>
					<xp:inputText id="lastName1" required="true" value="#{SendSubscriptionJavaBean.lastName}">
						<xp:this.validators>
							<xp:validateRequired
								message="LastName Required">
							</xp:validateRequired>
						</xp:this.validators></xp:inputText>
					<xp:br></xp:br><xp:message for="lastName1" />
				</xp:td>
				<xp:td>
					<xp:listBox id="identifyer1" style="width:141.0px" value="#{SendSubscriptionJavaBean.identifyer}">
						<xp:selectItem itemLabel="Mr." itemValue="Mr"></xp:selectItem>
						<xp:selectItem itemLabel="Mrs."
							itemValue="Mrs">
						</xp:selectItem>
						<xp:selectItem itemLabel="Miss"
							itemValue="Miss">
						</xp:selectItem>
						<xp:selectItem itemLabel="Other" itemValue="Other"></xp:selectItem>
					<xp:this.validators>
							<xp:validateRequired
								message="Identifyer Required">
							</xp:validateRequired>
						</xp:this.validators>
					</xp:listBox>
					<xp:br></xp:br><xp:message for="identifyer1" />
				</xp:td>
				<xp:td>
					<xp:inputText id="userID1" value="#{SendSubscriptionJavaBean.userID}" disabled="true"></xp:inputText>
					</xp:td>

			</xp:tr>
			<xp:tr>
				<xp:td></xp:td>
				<xp:td></xp:td>
				<xp:td></xp:td>
				<xp:td></xp:td>

			</xp:tr>
			<xp:tr>
				<xp:td style="font-weight:bold;font-size:11pt">
					EmailAddress
				</xp:td>
				<xp:td style="font-weight:bold;font-size:11pt">
					ConfirmEmail
				</xp:td>
				<xp:td style="font-weight:bold;font-size:11pt">
					MobilePhone
				</xp:td>
				<xp:td style="font-weight:bold;font-size:11pt">
					WorkPhone
					<xp:span style="font-size:9pt">(Optional)</xp:span>
				</xp:td>

			</xp:tr>
			<xp:tr>
				<xp:td>
					<xp:inputText id="emailAddress1" value="#{SendSubscriptionJavaBean.emailAddress}">
					
					<xp:this.validators>
							<xp:validateRequired
								message="EmailAddress Required">
							</xp:validateRequired>
						</xp:this.validators>
					</xp:inputText>
					<xp:br></xp:br><xp:message for="emailAddress1" />
				</xp:td>
				<xp:td>
					<xp:inputText id="confirmEmail1" value="#{SendSubscriptionJavaBean.confirmEmail}">
					
					
					<xp:this.validators>
							<xp:validateRequired
								message="ConfirmEmail Required">
							</xp:validateRequired>
						</xp:this.validators>
					
					</xp:inputText>
					<xp:br></xp:br><xp:message for="confirmEmail1" />
				</xp:td>
				<xp:td>
					<xp:inputText id="mobilePhone1" value="#{SendSubscriptionJavaBean.mobilePhone}">
					
					<xp:this.validators>
							<xp:validateRequired
								message="MobilePhone Required">
							</xp:validateRequired>
						</xp:this.validators>
					</xp:inputText>
					<xp:br></xp:br><xp:message for="mobilePhone1" />
				</xp:td>
				<xp:td>
					<xp:inputText id="workPhone1" value="#{SendSubscriptionJavaBean.workPhone}"></xp:inputText>
					<xp:br></xp:br><xp:message for="workPhone1" />
				</xp:td>

			</xp:tr>
			<xp:tr>
				<xp:td></xp:td>
				<xp:td></xp:td>
				<xp:td></xp:td>
				<xp:td></xp:td>

			</xp:tr>
			<xp:tr>
				<xp:td style="font-weight:bold;font-size:11pt">
					AdsType
				</xp:td>
				<xp:td style="font-weight:bold;font-size:11pt">
					RoleType
				</xp:td>
				<xp:td style="font-weight:bold;font-size:11pt">
					DeliveryType
				</xp:td>
				<xp:td style="font-weight:bold;font-size:11pt">
					ShelfLife
				</xp:td>

			</xp:tr>
			<xp:tr>
				<xp:td>
					<xp:listBox id="adsType1" style="width:137.0px"
						value="#{SendSubscriptionJavaBean.adsType}">

						<xp:this.validators>
							<xp:validateRequired
								message="AdsType Required">
							</xp:validateRequired>
						</xp:this.validators>
						<xp:selectItem itemLabel="Education Ads" itemValue="EduAds">
						</xp:selectItem><xp:selectItem itemLabel="Free Ads"
							itemValue="FreeAds">
						</xp:selectItem>
						
						<xp:selectItem itemLabel="Promotion Ads" itemValue="PromoAds"></xp:selectItem>
					</xp:listBox>
					<xp:br></xp:br><xp:message for="adsType1" />
				</xp:td>
				<xp:td>
					<xp:listBox id="userRoleType1" style="width:140.0px"
						value="#{SendSubscriptionJavaBean.userRoleType}">

						<xp:this.validators>
							<xp:validateRequired
								message="UserRole Required">
							</xp:validateRequired>
						</xp:this.validators>
						<xp:selectItem itemLabel="Employee" itemValue="Employee">
						</xp:selectItem><xp:selectItem itemLabel="Owner"
							itemValue="Owner">
						</xp:selectItem>
						
						<xp:selectItem itemLabel="Third Party" itemValue="ThirdParty"></xp:selectItem>
					</xp:listBox>
					<xp:br></xp:br><xp:message for="userRoleType1" />
				</xp:td>
				<xp:td>
					<xp:listBox id="deliveryType1" style="width:140.0px"
						value="#{SendSubscriptionJavaBean.deliveryType}">


						<xp:this.validators>
							<xp:validateRequired
								message="DeliveryType Required">
							</xp:validateRequired>
						</xp:this.validators>
						<xp:selectItem itemLabel="Email" itemValue="Email"></xp:selectItem>
						<xp:selectItem itemLabel="Mobile"
							itemValue="Mobile">
						</xp:selectItem>
						<xp:selectItem itemLabel="Social"
							itemValue="Social">
						</xp:selectItem>
						
					<xp:selectItem itemLabel="Web" itemValue="Web">
						</xp:selectItem></xp:listBox>
					<xp:br></xp:br><xp:message for="deliveryType1" />
				</xp:td>
				<xp:td>
					<xp:listBox id="shelfLife1" style="width:140.0px"
						value="#{SendSubscriptionJavaBean.shelfLife}">
						<xp:this.validators>
							<xp:validateRequired
								message="ShelfLife Required">
							</xp:validateRequired>
						</xp:this.validators>
						<xp:selectItem itemLabel="1 Week(s)"
							itemValue="1Week">
						</xp:selectItem>
						<xp:selectItem itemLabel="2 Week(s)"
							itemValue="2Week">
						</xp:selectItem>
						<xp:selectItem itemLabel="3 Week(s)"
							itemValue="3Week">
						</xp:selectItem>
						<xp:selectItem itemLabel="1 Month(s)"
							itemValue="1Month">
						</xp:selectItem>
						<xp:selectItem itemLabel="3 Month(s)"
							itemValue="3Month">
						</xp:selectItem>
						<xp:selectItem itemLabel="6 Month(s)"
							itemValue="6Month">
						</xp:selectItem>
						<xp:selectItem itemLabel="1 Year(s)"
							itemValue="1Year">
						</xp:selectItem>
						<xp:selectItem itemLabel="2 Year(s)"
							itemValue="2Year">
						</xp:selectItem>
						<xp:selectItem itemLabel="5 Year(s)" itemValue="5Year"></xp:selectItem>
					</xp:listBox>
					<xp:br></xp:br><xp:message for="shelfLife1" />
				</xp:td>

			</xp:tr>
			<xp:tr>
				<xp:td colspan="4"
					style="font-weight:bold;font-size:15pt;background-color:rgb(128,128,128)">
					Body
				</xp:td>



				<xp:td>
					<xp:button id="button3" style="width:339.0px">
					</xp:button>
				</xp:td>
			</xp:tr>
			<xp:tr>
				<xp:td colspan="4">
					<xp:inputTextarea id="body1"
						style="height:195.0px;width:596.0px" value="#{SendSubscriptionJavaBean.body}">
						
						
						<xp:this.validators>
							<xp:validateRequired
								message="Body Message Required">
							</xp:validateRequired>
						</xp:this.validators>
					</xp:inputTextarea>
					<xp:br></xp:br>
					<xp:br></xp:br>
					<xp:message for="body1" />
					<xp:br></xp:br>
					<xp:br></xp:br>
					<xp:label value="#{SendSubscriptionJavaBean.message}" id="errMessage1" style="width:298.0px;color:rgb(117,11,11);font-weight:bold;background-color:rgb(255,255,204);text-align:center">
										</xp:label><xp:br></xp:br>
				</xp:td>



				<xp:td>

					<xp:br></xp:br>
					<xp:image url="/opencasesbyagebar.jpg" id="image2"
						style="width:357.0px;height:294.0px">
					</xp:image>
				</xp:td>
			</xp:tr>
		</xp:table>
	</xp:panel>
	<xp:button value="Submit" id="button1"
								style="font-size:8pt;height:23.0px">
								<xp:eventHandler event="onclick"
									submit="true" refreshMode="complete" immediate="false"
									save="true" id="eventHandler1">

									<xp:this.action><![CDATA[#{javascript:SendSubscriptionJavaBean.doAddSubscription()}]]></xp:this.action>
								</xp:eventHandler>
							</xp:button>
	&#160;
	<xp:button value="Cancel" id="cancelButton"
								style="font-size:8pt;height:23.0px">
								<xp:eventHandler event="onclick"
									submit="true" refreshMode="complete">
									<xp:this.action><![CDATA[#{javascript:context.redirectToPage("xpsubscription");}]]></xp:this.action>
								</xp:eventHandler>
							</xp:button>
<xp:this.navigationRules><xp:navigationRule outcome="xsp-success" viewId="/xpsubscriptionedit.xsp"></xp:navigationRule></xp:this.navigationRules></xp:view>





Use excerpts of this Xpages code to create a new one, items plucked out to limit confusion, and to give you an idea what the page should look like...  Your main concern is the dataSource, buttons, and navigationRule...  

Here is the JavaBean code in question for this Xpage:
http://openntf.org/XSnippets.nsf/snippet.xsp?id=javabean-to-submit-values-and-record-cookie-sendsubscriptionjavabean.java

See Edit Xpages form in a bit...

XPages
Köll S Cherizard
March 18, 2014 6:47 PM
Rating
22

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.



No comments yetLogin first to comment...