Action Tags

From AgileApps Support Wiki

These tags directly map to various platform actions specified in the Actions section. These action tags render an HTML form element.

Common Attributes for Action Tags

All the action tags have some common attributes.

Common Attributes for Action Tags
Attribute Type Description
onError String Complete or partial relative URL to execute on error of the operation
onSuccess String Complete or partial relative URL to execute on success of the operation
method String maps to the HTML form element's method attribute
name String Name of the HTML form element which is rendered as a result of this tag
preController String Name of the class whose method is executed before the controller is executed
preControllerMethod String Method of the class identified by preController, that is executed before the controller is executed. Useful in validations or some pre actions when controller is Platform.
prefill Boolean Specifies whether the values should be prefilled for the form elements within this form. Prefill logic first looks at the HttpServletRequest.getParameter("form element"), if the value is present it will render it from there, otherwise it will take it from the value attribute of the form element. This is specifically used for error handling.

Login and Registration Tags

Login tags and Registration tags have slightly different behavior:

  • Registration tags - Allow the site user to register and login using a remote ID, like Facebook. When site users are already registered, they are automatically logged in. With this option, anyone can become a site user, and the only information available to the Site are the details captured in the remote registration process (at Facebook, for example).
  • Login Tags - Allow the user to login using a remote ID, but require them to have registered with the site to do so. You can use that registration process to a) capture additional information from the user and/or, b) restrict access in some way (for example, to restrict access to an otherwise-public company payroll site).

Typically, you will choose to use either registration tags or login tags. But whichever style you choose, you will typically provide site users with multiple options so they can choose how they want to log in.

Notepad.png

Note:
For Login tags to work, the user ID at the site must be identical to the remote user ID. One way to do that is simply to require the user to enter their ID, and trust that it will match. (Typically, it will, since a user's email address is the most common form of ID. Another, more "bulletproof" mechanism is to check to see if users are registered when they login. If they aren't, send them to the registration page with the user ID pre-filled. That mechanism is more complex, but doesn't depend on users' typing ability or memory.

Action Tag Description Syntax
Facebook Registration Tag Let a site user register and login using their Facebook ID <lj:facebookregister onError="pages/home.jsp" onSuccess="pages/ticketList.jsp?fieldList=..." />
Facebook Login Tag Let a site user login using their Facebook ID, but require site registration <lj:facebooklogin onError="pages/home.jsp" onSuccess="pages/ticketList.jsp?fieldList=..." />
Login Tag Renders an HTML form element whose action attribute is assigned to the Login action <lj:login name="loginForm" onError="pages/login.jsp" onSuccess="pages/home.jsp" method="POST" id="loginForm">
Logout Tag Renders a URL which points to the Logout action <a href="<lj:logout />">Logout</a>
Register Tag Renders an HTML form element whose action attribute is assigned to the Register User action <lj:register name="" onError="pages/register.jsp" onSuccess="pages/home.jsp" prefill="true" method="POST">
Note for Self-Hosted Installations of the Platform
In a self hosted installation of the Platform, additional setup is required to support registration and authentication using Facebook. The Administrator needs to set up a Facebook Application and configure details about the application in the platform.
To set up a Facebook Application:
  1. Go to https://developers.facebook.com and create a new Application.
  2. Modify the Application to set the App Domain to point to your domain.
  3. Specify the Site URL in "Website with Facebook Login", so it points to your Domain URL
  4. Note the App ID and the App Secret
To configure the platform:
Update the Facebook App ID and the App Secret in the Platform using SQL:
UPDATE relationals.NETWORK_GLOBAL_PROPERTIES
SET facebook_app_id = 'facebook App ID' , facebook_app_secret='App Secret';
Facebook Registration Tag

Generates a button that allows a site user to register and login using their Facebook ID. Users who are already registered with the Site are simply logged in.

Example
<%@taglib prefix="lj" uri="/LJTagLib"%>

<a href="<lj:facebookregister onError="pages/home.jsp"  
   onSuccess="pages/ticketList.jsp?fieldList=number,type,subject&sortBy=number&sortOrder=desc&page=0&pageSize=25" />" 
> Login using Facebook</a>
Facebook Login Tag

Generates a button that allows a site user to login using their Facebook ID, but only if they are a registered site user.

Requirement
  • The Site user's username must be the same as their Facebook Email address.
Example
<%@taglib prefix="lj" uri="/LJTagLib"%>

<a href="<lj:facebooklogin onError="pages/home.jsp" 
  onSuccess="pages/ticketList.jsp?fieldList=number,type,subject&sortBy=number&sortOrder=desc&page=0&pageSize=25" />" 
> Login using Facebook</a>
Login Tag

Renders an HTML form element whose action attribute is assigned to "login" action.

User is expected to supply all the form elements that are expected for this action. Refer to login action.

Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
<lj:login name="loginForm" onError="pages/login.jsp" onSuccess="pages/home.jsp" method="POST" id="loginForm">
<table border="0" cellspacing="0" cellpadding="5">
	<tr>
		<td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2">
    ${empty __response ? "" : __response.message}
	</td>
	</tr>
	<tr>
		<td align="left"><b>Username</b></td>
		<td align="left"><lj:text name="login" id="login" /></td>
	</tr>
	<tr>
		<td align="left"><b>Password</b></td>
		<td align="left"><lj:password name="password" id="password" /></td>
	</tr>
	<tr>
		<td align="right"><lj:button submit="true" name="submit" id="submit" value="Submit" /></td>
		<td align="left"><input type="button" name="cancel" value="Cancel" onClick="window.location='<lj:url resource="pages/home.jsp" />';" /></td>
	</tr>
	<tr>
		<td colspan="2" align="left"><a href="<lj:url resource="pages/forgot.jsp" />"> Forgot Your Password</a></td>
	</tr>
</table>
</lj:login>
Logout Tag

Renders a URL which points to the logout action.

User is expected to supply all the form elements that are expected for this action. Refer to logout action.

Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
<a href="<lj:logout />">Logout</a>
Register Tag

Renders an HTML form element whose action attribute is assigned to "register" action.

User is expected to supply all the form elements that are expected for this action. Refer to register action.

Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
<lj:register name="" onError="pages/register.jsp" onSuccess="pages/home.jsp" prefill="true" method="POST">
<table width="100%" border="0" cellpadding="0" cellspacing="5">
	<tr>
		<td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2">
    ${empty __response ? "" : __response.message}
		</td>
	</tr>
	<tr>
		<td align="left"><b>First Name</b></td>
		<td align="left"><lj:text name="first_name" value="${first_name}"/> </td>
	</tr>
	<tr>
		<td align="left"><b>Last Name</b></td>
		<td align="left"><lj:text name="last_name" value="${last_name}"/></td>
	</tr>
	<tr>
		<td align="left"><b>Email</b></td>
		<td align="left"><lj:text name="email" value="${email}"/></td>
	</tr>
	<tr>
		<td align="left"><b>User Name</b></td>
		<td align="left"><lj:text name="username" value="${username}"/></td>
	</tr>
	<tr>
		<td align="left"><b>Password</b></td>
		<td align="left"><lj:password name="password"/></td>
	</tr>
	<tr>
		<td align="left"><b>Confirm Password</b></td>
		<td align="left"><lj:password name="password2"/></td>
	</tr>
	<tr>
		<td align="left"><b>Security Question</b></td>
		<td align="left"><lj:text name="custom_security_question" value="${custom_security_question}"/></td>
	</tr>
	<tr>
		<td align="left"><b>Security Answer</b></td>
		<td align="left"><lj:text name="security_answer" value="${security_answer}"/></td>
	</tr>
	<tr>
		<td align="right"><lj:button submit="true" name="submit" value="Register"/></td>
		<td align="left"><input type="submit" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/home.jsp"/>'; return false;"/></td>
	</tr>
</table>
</lj:register>

Other Action Tags

Action Tag Description Syntax
Change Password Tag Renders an HTML form element whose action attribute is assigned to Change Password action <lj:changePassword name="" onError="pages/changePassword.jsp" onSuccess="pages/home.jsp">
Reset Password Tag Renders an HTML form element whose action attribute is assigned to Reset Password action <lj:resetPassword name="" onError="pages/resetPassword.jsp" onSuccess="pages/home.jsp">
Update Profile Tag Renders an HTML form element whose action attribute is assigned to Update Profile action <lj:updateProfile name="" onError="pages/updateProfile.jsp" onSuccess="pages/home.jsp" prefill="true">
Validate Security Question Tag Renders an HTML form element whose action attribute is assigned to the Validate the Security Question action. <lj:validateSecurityQuestion name="" onError="pages/secQuestion.jsp" onSuccess="pages/resetPassword.jsp" prefill="true">
Change Password Tag

Renders an HTML form element whose action attribute is assigned to "change_password" action.

User is expected to supply all the form elements that are expected for this action. Refer to changePassword action.

Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
<lj:changePassword name="" onError="pages/changePassword.jsp" onSuccess="pages/home.jsp">
<table cellpadding="5" cellspacing="0">
	<tr>
		<td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2">
    ${empty __response ? "" : __response.message}
		</td>
	</tr>
	<tr>
		<td align="left"><b>Old Password</b></td>
		<td align="left"><lj:password name="old_password" value=""/> </td>
	</tr>
	<tr>
		<td align="left"><b>New Password</b></td>
		<td align="left"><lj:password name="password" /></td>
	</tr>
	<tr>
		<td align="left"><b>Confirm Password</b></td>
		<td align="left"><lj:password name="password2" /></td>
	</tr>
	<tr>
		<td align="right"><lj:button submit="true" name="submit" value="Change"/></td>
		<td align="left"><input type="button" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/home.jsp"/>'; return false;"/></td>
	</tr>
</table>
</lj:changePassword>
Reset Password Tag

Renders an HTML form element whose action attribute is assigned to "reset_password" action.

User is expected to supply all the form elements that are expected for this action. Refer to Reset Password action.

Example
<%@taglib prefix="lj" uri="/LJTagLib"%>

<lj:resetPassword name="" onError="pages/resetPassword.jsp" onSuccess="pages/home.jsp">
<table cellpadding="5" cellspacing="0">
	<tr>
		<td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2">
    ${empty __response ? "" : __response.message}
		</td>
	</tr>
	<tr>
		<td align="left"><b>New Password</b></td>
		<td align="left" width="50%"><lj:password name="password" /></td>
	</tr>
	<tr>
		<td align="left"><b>New Password Again</b></td>
		<td align="left" width="50%"><lj:password name="password2" /></td>
	</tr>
	<tr>
		<td align="right"><lj:button submit="true" name="submit" value="Reset" /></td>
		<td align="left" width="50%"><input type="button" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/login.jsp"/>'; return false;"/></td>
	</tr>
</table>
</lj:resetPassword>
Update Profile Tag

Renders an HTML form element whose action attribute is assigned to "update_profile" action.

User is expected to supply all the form elements that are expected for this action. Refer to Update Profile action.

Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
<lj:updateProfile name="" onError="pages/updateProfile.jsp" onSuccess="pages/home.jsp" prefill="true">
<table border="0" cellpadding="0" cellspacing="5">
	<lj:detailData object="USER_PROFILE" controller="Platform" recordVariable="profile"> 
	<tr>
		<td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2">
    ${empty __response ? "" : __response.message}
		</td>
	</tr>
	<tr>
		<td align="left"><b>First Name</b></td>
		<td align="left"><lj:text name="first_name" value="${profile.parameters.first_name}" /> </td>
	</tr>
	<tr>
		<td align="left"><b>Last Name</b></td>
		<td align="left"><lj:text name="last_name" value="${profile.parameters.last_name}" /> </td>
	</tr>
	<tr>
		<td align="left"><b>Email</b></td>
		<td align="left"><lj:text name="email" value="${profile.parameters.email}" /> </td>
	</tr>
	<tr>
		<td align="left"><b>Street</b></td>
		<td align="left"><lj:text name="street" value="${profile.parameters.street}" /> </td>
	</tr>
	<tr>
		<td align="left"><b>City</b></td>
		<td align="left"><lj:text name="city" value="${profile.parameters.city}" /> </td>
	</tr>
	<tr>
		<td align="left"><b>State</b></td>
		<td align="left"><lj:text name="state" value="${profile.parameters.state}" /> </td>
	<tr>
		<td align="left"><b>Zip</b></td>
		<td align="left"><lj:text name="zip" value="${profile.parameters.zip}" /> </td>
	</tr>
	<tr>
		<td align="left"><b>Country</b></td>
		<td align="left"><lj:text name="country" value="${profile.parameters.country}" /> </td>
	</tr>
	<tr>
		<td align="left"><b>Company</b></td>
		<td align="left"><lj:text name="company" value="${profile.parameters.company}" /> </td>
	</tr>
	<tr>
		<td align="left"><b>Title</b></td>
		<td align="left"><lj:text name="title" value="${profile.parameters.title}" /> </td>
	</tr>
	<tr>
		<td align="left"><b>Division</b></td>
		<td align="left"><lj:text name="division" value="${profile.parameters.division}" /> </td>
	<tr>
		<td align="left"><b>Phone</b></td>
		<td align="left"><lj:text name="phone" value="${profile.parameters.phone}" /> </td>
	</tr>
	<tr>
		<td align="left"><b>Fax</b></td>
		<td align="left"><lj:text name="fax" value="${profile.parameters.fax}" /> </td>
	</tr>
	<tr>
		<td align="left"><b>Mobile</b></td>
		<td align="left"><lj:text name="mobile" value="${profile.parameters.mobile}" /> </td>
	</tr>
	<tr>
		<td align="left"><b>Security Question</b></td>
		<td align="left"><lj:text name="custom_security_question" value="${profile.parameters.custom_security_question}" /> </td>
	</tr>
	<tr>
		<td align="left"><b>Security Answer</b></td>
		<td align="left"><lj:text name="security_answer" value="${profile.parameters.security_answer}" /> </td>
	</tr>
</lj:detailData> 
<tr>
	<td align="right"><lj:button submit="true" name="submit" value="Update" /></td>
    <td align="left"><input type="submit" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/home.jsp"/>'; return false;"/></td>
</tr>
</table>
</lj:updateProfile>
Validate Security Question Tag

Renders an HTML form element whose action attribute is assigned to "validate_security_question" action.

User is expected to supply all the form elements that are expected for this action. Refer to Validate Security Question action.

Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
<lj:validateSecurityQuestion name="" onError="pages/secQuestion.jsp" onSuccess="pages/resetPassword.jsp" prefill="true">
<table border="0" cellpadding="5" cellspacing="0">
	<tr>
		<td colspan="2" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2">
    ${empty __response ? "" : __response.message}
		</td>
		<td>&nbsp;</td>
	</tr>
<lj:detailData object="USER_PROFILE" controller="Platform" recordVariable="user" recordId="${param['username']}"> 
	<tr>
		<td ${empty user ? "" : (user.code < 0 ? "style=\"color:red\"" : "")} colspan="2">
      ${empty user ? "" : user.message}
		</td>
    </tr>
    <tr>
		<td align="left"><b>Username</b></td>
		<td align="left">${user.parameters.username}<lj:hidden name="username" value="${user.parameters.username}"/></td>
    </tr>
    <tr>
		<td align="left"><b>Security Question</b></td>
		<td align="left">${user.parameters.custom_security_question}
        <lj:hidden name="custom_security_question" value="${user.parameters.custom_security_question}"/></td>
    </tr>
    <tr>
		<td align="left"><b>Security Answer</b></td>
		<td align="left"><lj:text name="security_answer" value="${security_answer}"/></td>
    </tr>
    <tr>
		<td align="right"><lj:button submit="true" name="submit" value="Submit"/></td>
		<td align="left"><input type="submit" name="button2" id="button2" value="Cancel" 
          onclick="window.location='<lj:url resource="pages/login.jsp"/>'; return false;"/></td>
    </tr>
  </lj:detailData>
</table>
</lj:validateSecurityQuestion>