Xpages form getting Custom Control items from JavaBean

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

<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom">

<xp:this.beforePageLoad><![CDATA[#{javascript:PageCosmeticsBean.PageSecurityAccessOkay()}]]></xp:this.beforePageLoad>

<!--<xp:this.beforePageLoad><![CDATA[#{javascript:PageCosmeticsBean.CustomControlsAccessOkay()}]]></xp:this.beforePageLoad>-->

	<xp:button value="User-Defined HelpDesk" id="button1"
		style="width:978.0px;font-size:18pt">
	</xp:button>


	<xp:table>

		<xp:tr>

			<xp:td style="background-color:rgb(234,248,214)">

				<xp:label id="label1" value="UserID"
					style="font-weight:bold;font-size:12pt;width:69.0px">

				</xp:label>

				<xp:br></xp:br>
				<hr></hr><xp:br></xp:br>
				<xp:label id="label13" value="Item Number"
					style="font-weight:bold;font-size:12pt;width:107.0px">
				</xp:label></xp:td>

			<xp:td style="background-color:rgb(234,248,214)">
				<xp:inputText id="userID1" required="true"

					value="#{SendAppUserIssuesJavaBean.userID}" disableClientSideValidation="true"


					defaultValue="#{javascript:URLAccessBean.getSearchText()}" disabled="true">



				</xp:inputText>
				<xp:br></xp:br>
				<hr></hr>
				<xp:br></xp:br><xp:inputText id="itemNumber1" required="true" value="#{SendAppUserIssuesJavaBean.itemNumber}" disableClientSideValidation="true" readonly="true">



				</xp:inputText>


			</xp:td>


			<xp:td style="background-color:rgb(234,248,214)">


				<xp:label id="label4" value="Subject"
					style="font-weight:bold;font-size:12pt;width:85.0px">


				</xp:label>


			</xp:td>


			<xp:td style="background-color:rgb(234,248,214)">


				


			<xp:include pageName="${PageCosmeticsBean.rdGrp}" id="include4" ></xp:include></xp:td>



			<xp:td style="background-color:rgb(234,248,214)">


				<xp:label id="label7" value="Priority"
					style="font-weight:bold;font-size:12pt;width:65.0px">


				</xp:label>


			</xp:td>


			<xp:td style="background-color:rgb(234,248,214)">


				<xp:include pageName="${PageCosmeticsBean.priority}" id="include1"></xp:include>


			</xp:td>



		</xp:tr>



		<xp:tr>


			<xp:td style="background-color:rgb(249,242,242)">


				<xp:label id="label3" value="SendTo"
					style="font-weight:bold;font-size:12pt;width:73.0px">


				</xp:label>


			</xp:td>


			<xp:td style="background-color:rgb(249,242,242)">


				<xp:listBox id="comboBox1"
					value="#{SendAppUserIssuesJavaBean.sendTo}" style="width:144.0px">

					<xp:selectItem itemLabel="Admin"
						itemValue="AlienHouse">
					</xp:selectItem>

					<xp:selectItem itemLabel="Developer"
						itemValue="dokollsolutions@gmail.com">
					</xp:selectItem>
					<xp:selectItem itemLabel="Tester"
						itemValue="username107">
					</xp:selectItem>
					<xp:selectItem itemLabel="User"
						itemValue="dokollsolutionsinc@gmail.com">
					</xp:selectItem>
				</xp:listBox>


			</xp:td>


			<xp:td style="background-color:rgb(249,242,242)">


				<xp:label id="label5" value="Requestor"
					style="font-weight:bold;font-size:12pt;width:126.0px">


				</xp:label>


			</xp:td>


			<xp:td style="background-color:rgb(249,242,242)">


				<xp:listBox id="comboBox2"
					value="#{SendAppUserIssuesJavaBean.requestor}" style="width:145.0px">

					<xp:selectItem itemLabel="Admin"
						itemValue="Admin">
					</xp:selectItem>
					<xp:selectItem itemLabel="General User"
						itemValue="User">
					</xp:selectItem>

					<xp:selectItem itemLabel="Developer"
						itemValue="Developer">
					</xp:selectItem>
					<xp:selectItem itemLabel="Tester"
						itemValue="Tester">
					</xp:selectItem>
				</xp:listBox>


			</xp:td>


			<xp:td style="background-color:rgb(249,242,242)">


				<xp:label id="label6" value="AssignedTo"
					style="font-weight:bold;font-size:12pt;width:103.0px">


				</xp:label>


			</xp:td>


			<xp:td style="background-color:rgb(249,242,242)">


				<xp:listBox id="comboBox3"
					value="#{SendAppUserIssuesJavaBean.assignedTo}"
					style="width:145.0px">

					<xp:selectItem itemLabel="Admin"
						itemValue="AlienHouse">
					</xp:selectItem>

					<xp:selectItem itemLabel="Developer"
						itemValue="dokollsolutions@gmail.com">
					</xp:selectItem>
					<xp:selectItem itemLabel="Tester"
						itemValue="username107">
					</xp:selectItem>
					<xp:selectItem itemLabel="User"
						itemValue="dokollsolutionsinc@gmail.com">
					</xp:selectItem>
				</xp:listBox>


			</xp:td>



		</xp:tr>


		<xp:tr>


			<xp:td style="background-color:rgb(234,248,214)">


				<xp:label id="label9" value="Category"
					style="font-weight:bold;font-size:11pt;width:72.0px">


				</xp:label>


			</xp:td>


			<xp:td style="background-color:rgb(234,248,214)">


				<xp:include pageName="${PageCosmeticsBean.category}" id="include2"></xp:include>


			</xp:td>


			<xp:td style="background-color:rgb(234,248,214)">


				<xp:label id="label2" value="Issues"
					style="font-weight:bold;font-size:12pt;width:62.0px">


				</xp:label>


			</xp:td>


			<xp:td style="background-color:rgb(234,248,214)">


				<xp:inputTextarea id="inputTextarea1" value="#{SendAppUserIssuesJavaBean.issues}" style="width:311.0px;height:105.0px">


				</xp:inputTextarea>


			</xp:td>


			<xp:td style="background-color:rgb(234,248,214)">


				<xp:label id="label8" value="Status"
					style="font-weight:bold;font-size:12pt;width:62.0px">


				</xp:label>


			</xp:td>


			<xp:td style="background-color:rgb(234,248,214)">


				<xp:include pageName="${PageCosmeticsBean.status}" id="include3"></xp:include>


			</xp:td>



		</xp:tr>



	</xp:table>


	<xp:panel>
	
	<xp:table>
	<xp:tr>

      <xp:td style="background-color:rgb(249,242,242)">
			<xp:label id="label10" value="Switch User"
				style="font-weight:bold;font-size:11pt;width:109.0px">


			</xp:label>


      </xp:td>


			<xp:td style="background-color:rgb(249,242,242)">


				<xp:comboBox id="comboBox4" style="width:144.0px">
					<xp:selectItem itemLabel="Select Option"></xp:selectItem><xp:selectItem itemLabel="AlienHouse"
						itemValue="AlienHouse">
					</xp:selectItem>
					<xp:selectItem itemLabel="username101"
						itemValue="username101">
					</xp:selectItem>
					<xp:selectItem itemLabel="username102"
						itemValue="username102">
					</xp:selectItem>
					<xp:selectItem itemLabel="username107"
						itemValue="username107">
					</xp:selectItem>
					
				</xp:comboBox>


			</xp:td>


			<xp:td style="background-color:rgb(249,242,242)">


				<xp:label id="label11" value="Cancel Access"
					style="font-weight:bold;font-size:12pt;width:125.0px">


				</xp:label>


			</xp:td>


			<xp:td style="background-color:rgb(249,242,242)">


				<xp:comboBox id="comboBox5" value="#{SendAppUserIssuesJavaBean.cancelAccess}" style="width:321.0px">
					<xp:selectItem itemLabel="Select Option"></xp:selectItem><xp:selectItem itemLabel="Header Access"
						itemValue="HeaderAsccess">
					</xp:selectItem>
					<xp:selectItem itemLabel="Footer Access"
						itemValue="FooterAccess">
					</xp:selectItem>

					<xp:selectItem itemLabel="Main Access"
						itemValue="MainAccess">
					</xp:selectItem>
					<xp:selectItem itemLabel="Navigation Access"
						itemValue="NavAccess">
					</xp:selectItem>
					
				</xp:comboBox>


			</xp:td>


			<xp:td style="background-color:rgb(249,242,242)">


				<xp:label id="label12" value="Reason"
					style="font-weight:bold;font-size:12pt;width:95.0px">


				</xp:label>


			</xp:td>


			<xp:td style="background-color:rgb(249,242,242)">


				<xp:comboBox id="comboBox6" value="#{SendAppUserIssuesJavaBean.reason}" style="width:145.0px">
					<xp:selectItem itemLabel="Select Option"></xp:selectItem><xp:selectItem itemLabel="Admin User"
						itemValue="Admin">
					</xp:selectItem>
					<xp:selectItem itemLabel="Compromised"
						itemValue="Compromised">
					</xp:selectItem>
					<xp:selectItem itemLabel="Developer"
						itemValue="Developer">
					</xp:selectItem>
					<xp:selectItem itemLabel="General User"
						itemValue="User">
					</xp:selectItem>
					<xp:selectItem itemLabel="New Access"
						itemValue="NewAccess">
					</xp:selectItem>
					<xp:selectItem itemLabel="Not Employed"
						itemValue="NotEmployed">
					</xp:selectItem>



					<xp:selectItem itemLabel="Tester"
						itemValue="Tester">
					</xp:selectItem>

					
				</xp:comboBox>

			</xp:td>
		</xp:tr>
		
		
		
		</xp:table>
		<xp:table>
		<xp:tr>
					<xp:td
						style="background-color:rgb(192,192,192);width:394.0px">
						<xp:span style="font-weight:bold;font-size:12pt">Attachment
					</xp:span></xp:td>
					<xp:td style="background-color:rgb(192,192,192)">
						<xp:fileUpload id="fileUpload1"
							value="#{SendAppUserIssuesJavaBean.uploadedFile}"
							style="width:305.0px" />
					</xp:td>
				</xp:tr>
				<xp:tr>
					<xp:td style="width:194.0px">
						<xp:button value="Submit" id="button2"
							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:SendAppUserIssuesJavaBean.submitEntry()}]]></xp:this.action>
							</xp:eventHandler>
						</xp:button>
						<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("xpusersubmit");}]]></xp:this.action>
							</xp:eventHandler>
						</xp:button>

					</xp:td>



				</xp:tr>
		</xp:table>
	</xp:panel><xp:this.navigationRules><xp:navigationRule outcome="xsp-success" viewId="/xpuserhelpdesklist.xsp"></xp:navigationRule></xp:this.navigationRules></xp:view>


Simply Copy below two radioGroups and modify to your liking for the addtional ones...  See instructions...





Copy this XSnippet to work with the JavaBean added earlier to collect Custom controls, based on user role data

INSTRUCTIONS:

For best results, create 8 custom controls: RadioGroupA, RadioGroupB through H, name their dataSource accordingly, in your case it can be YourJavaBean.RdGrp for RadioGroupA custom control, see JavaBean for input on how to write the rest.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++>>

CUSTOM CONTROL CODE

+++++++++++++++++++++++++++++++++++++++++++++++++++++++>>


RadioGroupA

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:radioGroup id="radioGroup2"
value="#{SendAppUserIssuesJavaBean.subject}" layout="pageDirection"
rendered="#{javascript:loginAppBean.CustomControlsAccessOkay()}">




<xp:selectItem itemLabel="File Access" itemValue="FileAccess">
</xp:selectItem>
<xp:selectItem itemLabel="Footer Access"
itemValue="FooterAccess">
</xp:selectItem>
<xp:selectItem itemLabel="Header Access"
itemValue="HeaderAccess">
</xp:selectItem>
<xp:selectItem itemLabel="Image Access" itemValue="ImgAccess">
</xp:selectItem>
<xp:selectItem itemLabel="Mainpage Acccess"
itemValue="MainAccess">
</xp:selectItem>


<xp:selectItem itemLabel="Navigation Access"
itemValue="NavAccess">
</xp:selectItem>
<xp:selectItem itemLabel="User Access" itemValue="UserAccess">
</xp:selectItem>
</xp:radioGroup>
</xp:view>




RadioGroupB



<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:radioGroup id="radioGroup2"
value="#{SendAppUserIssuesJavaBean.subject}" layout="pageDirection"
rendered="#{javascript:loginAppBean.CustomControlsAccessOkay()}">
<xp:selectItem itemLabel="File Access" itemValue="FileAccess">
</xp:selectItem>
<xp:selectItem itemLabel="Footer Access"
itemValue="FooterAccess">
</xp:selectItem>
<xp:selectItem itemLabel="Header Access"
itemValue="HeaderAccess">
</xp:selectItem>

</xp:radioGroup>
</xp:view>


the Custom controls are fed through the Page Include control by JavaBean, but there must already be Custom control code written, so Xpages can grab it and associate respective to the get Methods of RdGrp, Priority, etc...

<xp:td style="background-color:rgb(234,248,214)">





<xp:include pageName="${PageCosmeticsBean.rdGrp}" id="include4" ></xp:include>

</xp:td>

Added info:

Write a view containing the column CosmicType, and plug the role Admin in that column.  Users in this view should ONLY be Admins, if you wish to disallow other user from seeing the Admin RadioGroup, they should not be included in the view.

XPages
Köll S Cherizard
December 14, 2013 4:35 PM
Rating
21

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...