This website uses cookies. By clicking OK, you consent to the use of cookies. Click Here to learn more about how we use cookies.
OK
  • RSA.com
  • Products
    • Archer®
      • Archer®
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Downloads
      • Ideas
      • Knowledge Base
      • Archer® Exchange
      • Training
      • Upcoming Events
      • Videos
    • RSA® Fraud & Risk Intelligence Suite
      • RSA® Fraud & Risk Intelligence Suite
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication On-Premise
      • RSA® Adaptive Authentication On-Premise (Cassandra)
      • RSA® Adaptive Authentication for eCommerce
      • RSA® FraudAction Services
      • RSA® Web Threat Detection
      • Upcoming Events
      • Videos
    • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication Cloud
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Downloads
      • Events
      • Ideas
      • Knowledge Base
      • Training
      • Upcoming Patch Content
      • Videos
    • RSA® Adaptive Authentication Mobile SDK
      • RSA® Adaptive Authentication Mobile SDK
      • Advisories
      • Events
      • Ideas
      • Knowledge Base
      • Request Access
      • Training
    • RSA® Adaptive Authentication On-Premise
      • RSA® Adaptive Authentication On-Premise
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Downloads
      • Events
      • Ideas
      • Knowledge Base
      • Training
      • Videos
    • RSA® Adaptive Authentication On-Premise (Cassandra)
      • RSA® Adaptive Authentication On-Premise (Cassandra)
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Downloads
      • Events
      • Ideas
      • Knowledge Base
      • Training
      • Videos
    • RSA® Adaptive Authentication for eCommerce
      • RSA® Adaptive Authentication for eCommerce
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Ideas
      • Knowledge Base
      • Training
      • Videos
    • RSA® FraudAction Services
      • RSA® FraudAction Services
      • Advisories
      • Discussions
      • Documentation
      • Ideas
      • Videos
    • RSA® Web Threat Detection
      • RSA® Web Threat Detection
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Downloads
      • Ideas
      • Knowledge Base
      • Videos
    • RSA NetWitness® Platform
      • RSA NetWitness® Platform
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Downloads
      • Ideas
      • Integrations
      • Knowledge Base
      • Training
      • Upcoming Events
      • Videos
    • RSA NetWitness® Detect AI
      • RSA NetWitness® Detect AI
      • Documentation
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
    • RSA NetWitness® Investigator
      • RSA NetWitness® Investigator
      • Documentation
      • Download the Client
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
    • RSA NetWitness® Orchestrator
      • RSA NetWitness® Orchestrator
      • Overview
      • Documentation
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
    • RSA SecurID® Suite
      • RSA SecurID® Suite
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Downloads
      • Knowledge Base
      • Ideas
      • Integrations
      • Training
      • Videos
    • RSA® Identity Governance & Lifecycle
      • RSA® Identity Governance & Lifecycle
      • Advisories
      • Blog
      • Community Exchange
      • Discussions
      • Documentation
      • Downloads
      • Ideas
      • Knowledge Base
      • Training
      • Upcoming Events
      • Videos
    • RSA SecurID® Access
      • RSA SecurID® Access
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Downloads
      • Ideas
      • Integrations
      • Knowledge Base
      • Training
      • Upcoming Events
      • Videos
    • Other RSA® Products
      • Other RSA® Products
      • RSA® Access Manager
      • RSA® Data Loss Prevention
      • RSA® Digital Certificate Solutions
      • RSA enVision®
      • RSA® Federated Identity Manager
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
  • Resources
    • Advisories
      • Product Advisories on RSA Link
      • Archer®
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication Hosted
      • RSA® Adaptive Authentication On-Premise
      • RSA® Adaptive Authentication On-Premise (Cassandra)
      • RSA® Adaptive Authentication for eCommerce
      • RSA® FraudAction Services
      • RSA® Identity Governance & Lifecycle
      • RSA NetWitness® Platform
      • RSA SecurID® Access
      • RSA® Web Threat Detection
      • All Product Advisories
    • Blogs
      • Blogs on RSA Link
      • Archer®
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication On-Premise
      • RSA® Adaptive Authentication On-Premise (Cassandra)
      • RSA® Adaptive Authentication for eCommerce
      • RSA® Identity Governance & Lifecycle
      • RSA NetWitness® Platform
      • RSA SecurID® Access
      • RSA® Web Threat Detection
      • All Blogs on RSA Link
    • Discussion Forums
      • Discussion Forums
      • Archer®
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication On-Premise
      • RSA® Adaptive Authentication On-Premise (Cassandra)
      • RSA® Adaptive Authentication for eCommerce
      • RSA® FraudAction Services
      • RSA® Identity Governance & Lifecycle
      • RSA NetWitness® Platform
      • RSA SecurID® Access
      • RSA® Web Threat Detection
      • All Discussion Forums on RSA Link
    • Documentation
      • Product Documentation
      • Archer®
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication Mobile SDK
      • RSA® Adaptive Authentication On-Premise
      • RSA® Adaptive Authentication On-Premise (Cassandra)
      • RSA® Adaptive Authentication for eCommerce
      • RSA® FraudAction Services
      • RSA® Identity Governance & Lifecycle
      • RSA NetWitness® Platform
      • RSA SecurID® Access
      • RSA® Web Threat Detection
      • All Documentation on RSA Link
    • Downloads
      • Product Downloads
      • Archer®
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication On-Premise
      • RSA® Adaptive Authentication On-Premise (Cassandra)
      • RSA® Identity Governance & Lifecycle
      • RSA NetWitness® Platform
      • RSA SecurID® Access
      • RSA® Web Threat Detection
      • All Downloads on RSA Link
    • Ideas
      • Idea Exchange
      • Archer®
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication Mobile SDK
      • RSA® Adaptive Authentication On-Premise
      • RSA® Adaptive Authentication On-Premise (Cassandra)
      • RSA® Adaptive Authentication for eCommerce
      • RSA® FraudAction Services
      • RSA® Identity Governance & Lifecycle
      • RSA NetWitness® Platform
      • RSA SecurID® Access
      • RSA® Web Threat Detection
      • All Documentation on RSA Link
    • Knowledge Base
      • Knowledge Base
      • Archer®
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication Mobile SDK
      • RSA® Adaptive Authentication On-Premise
      • RSA® Adaptive Authentication On-Premise (Cassandra)
      • RSA® Adaptive Authentication for eCommerce
      • RSA® Identity Governance & Lifecycle
      • RSA NetWitness® Platform
      • RSA SecurID® Access
      • RSA® Web Threat Detection
      • All Knowledge Base Pages on RSA Link
    • Upcoming Events on RSA Link
      • Upcoming Events
    • Videos
      • Videos on RSA Link
      • Archer®
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication On-Premise
      • RSA® Adaptive Authentication On-Premise (Cassandra)
      • RSA® Adaptive Authentication for eCommerce
      • RSA® Identity Governance & Lifecycle
      • RSA NetWitness® Platform
      • RSA SecurID® Access
      • RSA® Web Threat Detection
      • All Videos on RSA Link
  • Support
    • RSA Link Support
      • RSA Link Support
      • News & Announcements
      • Getting Started
      • Support Forum
      • Support Knowledge Base
      • Ideas & Suggestions
    • RSA Product Support
      • RSA Product Support
      • General Security Advisories and Statements
      • Product Life Cycle
      • Support Information
      •  
      •  
      •  
      •  
      •  
  • RSA Ready
  • RSA University
    • Certification Program
      • Certification Program
    • Course Catalogs
      • Course Catalogs
    • On-Demand Subscriptions
      • On-Demand Subscriptions
      • Archer®
      • RSA NetWitness® Platform
      • RSA SecurID® Suite
    • Product Training
      • Product Training
      • Archer®
      • RSA® Fraud & Risk Intelligence Suite
      • RSA® Identity Governance & Lifecycle
      • RSA NeWitness® Platform
      • RSA SecurID® Access
    • Student Resources
      • Student Resources
      • Access On-Demand Learning
      • Access Virtual Labs
      • Contact RSA University
      • Enrollments & Transcripts
      • Frequently Asked Questions
      • Getting Started
      • Learning Modalities
      • Payments & Cancellations
      • Private Training
      • Training Center Locations
      • Training Credits
      • YouTube Channel
    • Upcoming Events
      • Upcoming Events
      • Full Calendar
      • Conferences
      • Live Classroom Training
      • Live Virtual Classroom Training
      • Webinars
Sign In Register Now
cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Search instead for 
Did you mean: 
Announcements

RSA Link website migration to new platform is in progress

View Status

RSA® Identity Governance & Lifecycle Blog

Subscribe to the official RSA Identity Governance & Lifecycle blog for information about new product features, industry insights, best practices, and more.
  • RSA Link
  • :
  • Products
  • :
  • RSA SecurID Suite
  • :
  • RSA Identity Governance & Lifecycle
  • :
  • Blogs
  • :
  • Request Forms - Validation

Request Forms - Validation

SeanMiller1
Moderator SeanMiller1 Moderator
Moderator
13 1 822
  • Subscribe to RSS Feed
  • Mark as New
  • Mark as Read
  • Bookmark
  • Subscribe
  • Email to a Friend
  • Printer Friendly Page
  • Report Inappropriate Content
‎2015-11-05 10:52 AM

Validation is a key thing to consider when building a form.  While you have the submitter's attention, you should ensure the data is accurate and nothing is missing that will lead to a bottleneck later when processing the request.  For example, if I need a cost center to do the billing for the fulfillment, get that up front and ensure it is right rather than create an activity assigned to someone later on.

 

You can do the validation at two different levels:

  • Field level
  • Form level

 

Field Level

Field level validation is useful to ensure the value entered meets expectations.  This is specific to the field.  If the validation is more specific to the interaction of multiple fields, it is probably best done as a form level validation script.

 

So how do I do field level validation?  Every form control has an optional validation URI field.  If specified, this url will get called when the control's value changes.

 

This URI is expected to adhere to the following contract:

  • Input Parameters: Request parameters with the following names (name, question, value)
  • Output: Print error message (if any). Empty to proceed.

 

Example: Validate Phone

In this example we are validating the field has a value properly formatted as a phone number:

<%

    String name = request.getParameter("name");

    String question = request.getParameter("question");

    String value = request.getParameter("value");

    if (value == null || !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 Level

Form level validation is useful when you want to evaluate the entire request that is being submitted.  For example, you may want to validate that if the region field is Canada that certain fields are provided (you could also solve this using conditions and is required flags).

 

Similar to field level validation, you specify a URI to invoke when the Next button is clicked to submit the form.  This URI is specified on the form detail page.

 

This URI is expected to adhere to the following contract:

  • Input Parameters: Request parameters prefixed by 'value.' or 'question.'
  • Output: Print error message(s) (if any). Empty to proceed.

 

Example: Validate Form

In this example we are looking at what form values we have an print that out.  Lastly, this example validates that the form had a v2 field with an expected value:

<%@ page import="java.util.Enumeration" %>

<%@ page import="java.util.HashMap" %>

<%@ page import="java.util.Properties" %>

<%@ page import="java.io.ByteArrayOutputStream" %>

<%

    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);

    }

 

    System.out.println("validateform.jsp request method=" + request.getMethod());

    System.out.println("validateform.jsp parameterMap=" + request.getParameterMap());

    System.out.println("validateform.jsp values=" + values);

    System.out.println("validateform.jsp questions=" + questions);

 

    Properties outputProps = new Properties();

 

    if (!values.containsKey("v2")) {

        outputProps.put("error","Where is the v2 field!");

    } else if (!values.get("v2").contains("Demo")) {

        outputProps.put("error.v2","I am expecting the word Demo here");

        outputProps.put("error","Form validation failed!");

    }

 

    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

    outputProps.store(outputStream, null);

    outputStream.close();

    out.print(outputStream.toString("ISO-8859-1"));

%>

 

 

 

Posting Your Validation Scripts

The validation scripts represent custom logic you will want to ship as part of your solution.  The best way to do this is by uploading the scripts using the Admin->User Interface->Files page.  Files that are uploaded this way have a number of benefits:

  • The scripts are stored as part of our database so they are backed up
  • Scripts are not lost when patches or upgrades are applied
  • No redeployment of the application (EAR) is required

 

Once you have uploaded script using the above method, you can reference the script using the uri:

/aveksa/custom/jsp/<your validation form>.jsp

Tags (12)
  • Tags:
  • forms
  • Identity G&L
  • Identity Governance & Lifecycle
  • IG&L
  • IGL
  • RSA Identity
  • RSA Identity G&L
  • RSA Identity Governance & Lifecycle
  • RSA Identity Governance and Lifecycle
  • RSA IGL
  • v6.9
  • v7
13 Likes
Share
1 Comment
FrankSchubert
FrankSchubert Beginner
Beginner
‎2017-04-10 02:23 PM
  • Mark as Read
  • Mark as New
  • Bookmark
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Just a side-note. I've just burned too much time figuring out the following:

 

I accumulated several error conditions in if() clauses in a string variable errorMessage and at the bottom simply do a 

 

outputProps.put("error",errorMessage);

 

outside of any if().... that was the problem as now I had an "error" property with an empty value. that alone then caused the submitted (and valid) form to simply reload with visible cause. making sure the property only gets added when an error occurred fixed this.

1 Like

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

  • Comment
Latest Articles
  • RSA Identity Governance & Lifecycle Webinar #16 - ...
  • RSA Identity Governance & Lifecycle Newsletter - J...
  • How to generate Oracle database performance statis...
  • RSA Identity Governance & Lifecycle Webinar #15 - ...
  • Maintain database footprint
  • Maintaining the database for optimal performance
  • video 34758
  • RSA Identity Governance & Lifecycle Webinar #14 - ...
  • RSA Identity Governance & Lifecycle Newsletter - O...
  • video 34700
Labels
  • Announcements 6
  • Features 17
  • Resources 4
  • Tutorials 8
  • Use Cases 4
  • Videos 113
  • Webinars 13
Powered by Khoros
  • Products
  • Resources
  • Solutions
  • RSA University
  • Support
  • RSA Labs
  • RSA Ready
  • About RSA Link
  • Terms & Conditions
  • Privacy Statement
  • Provide Feedback
© 2020 RSA Security LLC or its affiliates.
All rights reserved.