ucAddSubmit
Purpose
This method is called after the form is submitted, during the Add process and before the umbrella of problem objects is created. It allows access to the parameters before they have been manipulated.
Applies To
Add Issue screen
Signature
public String ucAddSubmit (
SesameSession session, // current session
ProblemFormParam values) // contains values of form params
Notes
Any string returned will cause the process to stop and the value of that string will be displayed to the user in the form of a JavaScript alert box.
Example
This example checks to see if the ‘Password’ field value meets the configured password requirements. If it does not, then a JavaScript alert box will inform the user that there is an error, and the ‘Password’ and ‘Verify Password’ field values will be cleared.
public String ucAddSubmit (
SesameSession session, // current session
ProblemFormParam values) // contains values of form params
{
String areaId = (String) values.get("AREA");
String projId = (String) values.get("PROJECT");
Z.log.writeToLog(Z.log.DEBUG, "UC: ucAddSubmit - areaId=" + areaId +
", projId=" + projId);
// Call Business Rules
String errMsg = super.ucAddSubmit(session, values);
if (errMsg != null) {
return errMsg;
}
if (AREA__CUSTOMER_ISSUES.equals(areaId) )
{
boolean validPassword = false;
String userPwd = null;
String userId = session.getUserId();
userPwd = (String) values.get("CONTACT_PASSWORD");
if (userPwd != null) { userPwd = userPwd.trim(); }
validPassword = UserAccountUtils.isValidPassword(userPwd, session, userId);
if (validPassword == false) {
errMsg = "ERROR: The 'Password' does not meet the " +
"minimum requirements established by your System Administrator.";
}
// Clear out the 'Password' & 'Verify Password' field values,
// and return error if password was invalid
if (errMsg != null)
{
Iterator iter = values.entrySet().iterator();
while (iter.hasNext()) {
String key = (String) iter.next().toString();
if (key.equals("CONTACT_PASSWORD") ||
key.equals("CONTACT_PASSWORD_VERIFY") ) {
values.remove(key);
}
}
return errMsg;
}
}
return null;
}