Hi,
I have a requirement which says that if user providing the end date which is greater than 6 month then a dialog box should prompt/trigger notify that " Please provide the date which is below 6 month"(depends on the start date value)
Can anyone please help me to proceed this ?
Regards,
Hemanth
There is a very good example regarding external form validation in RSA ARM (Access Request Manager) doc. You may want to refer that.
About External Form Validation
External form validation comprises both field and form validation.
Field Validation
For field validation, the URI is called with three parameters:
• name — The Variable Name defined on the field.
• question — The Question defined on the field.
• value — The value for the name/question to test.
If there is an error, the error should reference the question. For no error, the response should be
empty (whitespace is ignored). If the URI does not include the schema, hostname, and port, these
are added.
For example, if you have a demo.war with validatephone.jsp script that validates a phone number
provided by a form user in response to question on the form and this application is accessible on
the same server as "/demo," then the Validation URI should be /demo/validatephone.jsp, and
validatephone.jsp would look similar to the following:
<%
String name = request.getParameter("name");
String question = request.getParameter("question");
String value = request.getParameter("value");
if (!value.matches("[(][0-9][0-9][0-9][)]
?[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]")) {
out.println("Invalid phone number for " + question + ", expected (###)
###-####");
}
%>
Form Validation
For form validation, the URI is called with two parameters for each field:
• value.variable — The name contains the value.
• question.variable — The name contains the question.
Form level validation also includes the attributes of key objects:
Conditionalizing and Enabling the Display of Fields on a Form
Access Request Manager Guide 37
• avform.application.<attributes> — The associated application object (if application form)
• avform.businessunit.<attributes> — The associated business unit object (if business unit form)
• avform.requestor.<attributes> — The logged in user making request
• avform.users[index].<attributes> — The target users (only index 0 if there is one user)
Because of the large number of parameters, this request uses the POST method. Attributes that
have null values do not have their parameters added. If there is an error, the error should take the
form:
• error.variable-name1=error message
• error.variable-name2=error message
• error=A global error message, if one is needed
For example, if you have a demo.war with validateform.jsp and this application is accessible on the
same server as "/demo," then the Validation URI should be /demo/validateform.jsp and
validateform.jsp would look something like:
<%@ page import="java.util.Enumeration" %>
<%@ page import="java.util.HashMap" %>
<%
HashMap<String, String> values = new HashMap<String, String>();
HashMap<String, String> questions = new HashMap<String, String>();
// Make the parameters and questions easy to access
for (Enumeration e = request.getParameterNames(); e.hasMoreElements();) {
String name = e.nextElement().toString();
String value = request.getParameter(name);
if (name.startsWith("value.")) values.put(name.substring(6), value);
if (name.startsWith("question.")) questions.put(name.substring(9), value);
}
if (!values.containsKey("something else")) {
out.println("error=Where is the something else field!");
return;
}
if (!values.get("something else").contains("Important")) {
out.println("error.something else=Where is the \"Important\" in " +
questions.get("something else"));
return;
}
38 Access Request Manager Guide
Chapter 4: Creating and Managing Access Request Forms
%>