Symantec IGA

  • 1.  Identity Portal 14.0 - form validation fail

    Posted Feb 28, 2017 09:50 AM

    Hi,

    I have created simple user creation form in Identity portal and performing some simple validation using validation handler on form submit. when I am trying to submit the form not able to see the custom message, but I can see a general message "Validation error".

    Below is the  validation handler code and attached is the error screenshot

    function validate(api, prop){

       if(prop.value.length == 3){

          return true;

       } else {

          prop.error = "Input must contains 3 characters";
          return false;

      } 

    }

     



  • 2.  Re: Identity Portal 14.0 - form validation fail
    Best Answer

    Broadcom Employee
    Posted Feb 28, 2017 12:24 PM

    Make this change

     

    function validate(api, prop){

       if(prop.value.length == 3){

          return true;

       } else {

          prop.error = "Input must contains 3 characters";
          return false;

      } 

    return true;

    }

     

    you have to have the code return true of false regardless of the logic. your return true is inside the if so it will not complied

     

    Itamar



  • 3.  Re: Identity Portal 14.0 - form validation fail

    Posted Feb 28, 2017 12:48 PM

    Hi, 

     

    I have modified the code as suggested and tested, but its not effected.

     

     



  • 4.  Re: Identity Portal 14.0 - form validation fail

    Broadcom Employee
    Posted Feb 28, 2017 12:50 PM

    there is a typo in line 2, ture instead of true



  • 5.  Re: Identity Portal 14.0 - form validation fail

    Posted Feb 28, 2017 05:19 PM

    Hi,

     

    Sorry for the typo.

     

    I am still facing the same error. Below is  the code and error screenshot

    function validate(api, prop){

       if(prop.value.length == 3){
          return true;
       } else {
          prop.error = "Invalid object name";
          return false;
       }
       return true;

    }

     



  • 6.  Re: Identity Portal 14.0 - form validation fail

    Broadcom Employee
    Posted Feb 28, 2017 05:24 PM

    Somthing is missing here. Can you please share a screen shot of the form field please

     

    Itamar



  • 7.  Re: Identity Portal 14.0 - form validation fail

    Posted Feb 28, 2017 05:45 PM

    Hi,

     

    I have written this validation only on FirstName field, apart from this no validation has been implemented on other two fields.

     



  • 8.  Re: Identity Portal 14.0 - form validation fail

    Broadcom Employee
    Posted Mar 01, 2017 08:53 AM

    Hi

     

    Let's try to debug your code.

     

    paste this code in:

     

    function validate(api, prop){

    debugger;

       if(prop.value.length == 3){
          return true;
       } else {
          prop.error = "Invalid object name";
          return false;
       }
       return true;

    }

     

    On you browser, press F12 and load the form, once submit is done, you will see a debug console which will allow you to run the code one line at a time which will allow you to see what is wrong

     

    Itamar



  • 9.  Re: Identity Portal 14.0 - form validation fail

    Posted Mar 01, 2017 09:01 AM
      |   view attached

    Hi,

     

    Its workin now, please see the update inline.

     

    Thanks & Regards,

     

    <http://www.techmahindra.com/>

     

    Harilal Lambadi

     

    Technical Specialist / ESEC

     

    Aalborg / Denmark

     

    +45-7185-5156

     

    Harilal.Lambadi@techmahindra.com<mailto:abinash.behera@techmahindra.com>

    QHL@kmd.dk<mailto:QHL@kmd.dk>



  • 10.  Re: Identity Portal 14.0 - form validation fail

    Broadcom Employee
    Posted Aug 07, 2018 09:25 AM

    Hello,

    It exist within the CA Identity Portal Guide an incorrect statement regarding custom message in "Form Handler Examples" (Create Forms - CA Identity Portal - 14.1 - CA Technologies Documentation )

     

    Where the Validate Handler example refers to :

    prop.error = "Invalid object name: " + prop.value;

    However error messages are handled within an array through prop.errors as documented within the Hotel Reservation Form Example

    (https://docops.ca.com/ca-identity-suite/14-1/EN/programming/ca-identity-portal-developer-guide/form-handlers/hotel-reservation-form-example)

    prop.errors = [result.returnValue];

     

    Best regards, Laurent