IBM R1 manual Submitting a form, Canceling the submission of a form

Page 45

Submitting a form

If you remove the nav attribute and add an onClick attribute, you completely change the functionality of the button. This code, for the Login button on the loginForm JSP for the Learning Management System server, executes a JavaScript submitForm() function when the button is clicked. This effectively logs the user into the application.

<lms:button captionKey="button.login" onClick="javascript:submitForm('loginForm');"

tooltipKey="button.login"/>

The Login button on the deliveryLoginForm JSP for the Delivery server contains similar code:

<lms:button captionKey="ds.toolbar.login" onClick="javascript:submitForm();"

tooltipKey="ds.toolbar.login"/>

Canceling the submission of a form

If you remove the onClick attribute and add an isSubmit attribute set to false, the button now specifically prevents the entries on the current form from being saved. This code, for a Cancel button on the assignVendor JSP, sets the isSubmit attribute to false. It includes an href attribute that contains JavaScript code which instructs the current window to close when the button is clicked.

<lms:button captionKey="button.cancel" isSubmit="false" tooltipKey="button.cancel"

href="javascript:window.close()"/>

To edit a tag:

1.Look at the TLD file referenced by the prefix of the tag you want to edit. This contains a list of attributes associated with the tag.

2.Edit the JSP tag to add, remove, or change the values of the tag’s attributes.

Note: Do not remove required attributes. The TLD file identifies attributes that are required by specifying “true” in the body of the <required> tag.

For more information on looking at the TLD file to see a tag’s attributes, see “The anatomy of a TLD file.”

Editing form Bean values with the lms:hidden tag

The lms:hidden tag is a tag that produces an HTML input tag with a type attribute value set to “hidden.” This tag enables you to get and set values in the form Bean (which is a Java component that, among other things, saves user input) associated with the current form.

The name attribute identifies the form Bean. The property attribute represents a property setting in the form Bean. The value attribute sets the input tag values, which can be later saved to the form bean. If you do not supply a value attribute, the HTML input tag gets values for specified properties from the form Bean.

The following code creates a hidden HTML input tag. Because a value attribute is supplied, the resulting input tag sets the “destination” property of the form Bean associated with the assignVendor.jsp to that value. The value is set using a JSP expression that gets the value of the destination parameter from the user request:

<lms:hidden property="destination" value='<%=request.getParameter("destination")%>'

/>

40 IBM Lotus Learning Management System Release 1 Customization Guide

Image 45
Contents Customization Guide Disclaimer Licensed Materials Property of IBMList of Trademarks Page Table of Contents Customization sets Creating a tabIndex Customizing the user interface Acronyms and abbreviations Disclaimer and a word about conventionsAcronym or What it stands for Abbreviation Page Changing settings Chapter Changing settings through the user interface or XMLPage To add a role to the system Chapter Controlling access to features through permissionsTo assign a role to a user To modify permissions settings for an existing roleTo automatically assign a role to a user To explicitly assign a role to a userControlling access to features Page Anatomy of a Help topic Chapter Customizing HelpScript Background-repeat repeat-x Mosaic-bgScript Head Editing an existing Help topic Replacing a context-sensitive Help topicLmsform action=/prefSubmit.do % Adding your own Help topic HREF=shenrolled.html target=topEnrolled courses/Abr HREF=shnotifications.html target=topNotifications/AbrOverview Chapter Customizing JavaServer PagesAnatomy of a TLD file LMS JSP tag librariesServerNameWEB-INFtld Referencing the url tag in a JSP String formName = request.getParameterformNameDefining the url tag in the TLD file ServerNameWEB-INFclassescomlotuselearntaglib Rtexprvaluetrue/rtexprvalue Attribute TagLearning Management System server Anatomy of a JSPDefining a page as a JSP Localizing page content Including tag library descriptor filesReferencing Struts tags Including the JSPs that comprise the main template Including JavaScript source codeLogicnotPresent LogicnotMatch Td class=formBoxTitleBg colspan=3 valign=middle nowrapDiv class=formBoxPositionInner DivLogicpresent LogicnotPresent logicpresent name=invalidFormLocalizing page text Delivery serverDisplaying errors to the user Script language=JavaScript src=js/delivery.js/scriptPopulating a frameset in a JSP Defining resizable frames Frameset Html Making global changesChanging the application style Applying customization setsServerNamecsslanguageCodebrowserType Editing existing CSS filesLanguage-version Browser-versionReplacing CSS files Adding your own CSS filesChanging the font size or font style of the application @import urlmyStyles.cssServerNameWEB-INFclassesresourcesserverNameproperties Updating page textApplication.title = IBM Lotus Learning Management System Titlelmsmessage key=application.title //titleAdding and replacing graphics Lmslinklmsimg src=images/name.gif… //lmslinkLearning Management System server Replacing the application logoImage.alt.logo = IBM Lotus Learning Management System Delivery serverReplacing a reference to a CSS style Changing individual JSPsDeliverylogoURL resource=images/myCompanyLogo.gif Changing the style of an individual JSPEditing existing JSP tags Changing the functionality of an individual JSPSpecifying the next page to display Canceling the submission of a form Submitting a formEditing form Bean values with the lmshidden tag Lmshidden name=%=formName% property=unmodifiedKeywords Removing JSP tagsLmshidden property=userEvent Custom fieldsIt then checks to see if its a text box type field LogicnotPresent Logicequal Page Customizing user searches Chapter Customizing SearchAdding Ldap attributes to User Search pages Attribute name=HealthPlanChoice type=java.lang.StringRemoving fields from User Search pages HealthPlanChoice = Employees Health PlanCustomizing course management and resource searches Customizing Offerings Catalog searchesAdding custom fields to the Offerings Catalog Removing fields from Offerings Search pagesRemoving fields from the Search pages Creating a customization set Chapter Customization setsLMM De en Etc De en etc. SalesCSPage Attribute Name Type Modified Size Path Customization sets Page Users Chapter Creating a tab@ taglib uri=/WEB-INF/tld/lms.tld prefix=lms % Users.jspTd width=1 valign=top Page Users.rosterUsers.subtitle = Roster Users Navigation.xml Users.rosterUsers.search.confirm Users.rosterUsers.searchTrail TrailManageRoles TrailTrail TrailManageProfiles Trail TrailManageUsersName tag page names and resourced text Content tag JSP file namesTarget tag struts action-mapping Label tag breadcrumbsUsers.rosterUsers.search.confirm Title tag title bar text Adding custom permissionsPermissions tag permission to display HelpPage tag context-sensitive HelpOid UpdatetimeName Permid0000000000000000PERM 0000000000003000PERM 0000000000009300PERM Copy the JSPs ExamplePage Creating a tab END Index Content Area Creating a tab Div Second linked page customGoodbye.jsp looks like this Page Create Help files Customtab.htmlCustomtabb.html Select Maxpermid from Permission Add permissions to the LMS databaseEdit ApplicationResources.properties Navigation Edit navigation.xmlAssign permissions Namestudenthome/nameCreating a tab Page Index