X

Shay Shmeltzer's Oracle Development Tools Tips

Required Field Validation in Oracle MAF

Shay Shmeltzer
Director of Product Management - Oracle

A short entry to explain how to do field validation in Oracle MAF. As an example let's suppose you want a field to have a value before someone clicks to do an operation.

To do that you can set the field's attribute for required and "show required" like this:

  <amx:inputText label="label1" id="it1" required="true" showRequired="true"/>

 Now if you run your page, leave the field empty and click a button that navigates to another page, you'll notice that there was no indication of an error. This is because you didn't tell the AMX page to actually do a validation. 

 To add validation you use an amx:validationGroup tag that will surround the fields you want to validate.

For example:

     <amx:validationGroup id="vg1">

    <amx:inputText label="label1" id="it1" required="true" showRequired="true"/>

    </amx:validationGroup>

Then you can add a amx:validateOperation tag to the button that does navigation and tell it to validate the group you defined before (vg1 in our example).

       <amx:commandButton id="cb2" text="go" action="gothere">

        <amx:validationBehavior id="vb1" group="vg1"/>

      </amx:commandButton>

Now when you run the page and try to navigate you'll get your validation error.

Join the discussion

Comments ( 3 )
  • guest Tuesday, June 2, 2015

    Is there an option to customize the message that gets displayed on error?

    Thanks

    AJ


  • pallavi Friday, January 22, 2016

    Hi shay,

    unable to fire the validation when the binding object is integer.

    Thanks,

    Pallavi.


  • Yas Wednesday, July 29, 2020
    Hi Shy,

    We are modifying one field in std MAF application to set required true but its not working.
    Any recommendation.

    Regards
    Yas
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.