Symantec IGA

 View Only
  • 1.  Identity Portal 14.3 - Validation error

    Posted Aug 06, 2019 03:28 AM
    Hi Team,
    I have follow the CA docops link to build a validation function in Identity Portal
    https://docops.ca.com/ca-identity-portal/14-3/EN/programming/ca-identity-portal-developer-guide/form-handlers/hotel-reservation-form-example

    Below is my sample code copy from the CA docops. But seem like there is syntax error on line 12.Unrecoverable syntax error.(92% scanned).


    But i have check the syntax, it is correct. But I can't figure out what's wrong, anyone experience this before, can advice ?

    regards,
    William



  • 2.  RE: Identity Portal 14.3 - Validation error

    Broadcom Employee
    Posted Aug 06, 2019 10:36 AM
    Not sure if the picture is not clear, but it seems to me that on line 12 (before the semi-colon) you have a ')' instead of '}' 



  • 3.  RE: Identity Portal 14.3 - Validation error

    Broadcom Employee
    Posted Aug 06, 2019 11:17 AM
    Are you missing a } at the end? Note line 0 has an open { and then there are 2 more on lines 4 and 8.  You have only 2 closures; I think you need one more to correct the syntax.  








  • 4.  RE: Identity Portal 14.3 - Validation error

    Posted Aug 06, 2019 07:59 PM
    Hi Team,
    Here's the complete sample code , which copied from CA Docops website.
    Function validate(api, prop) {
    var arrival =new Date(api.getProp('arrival').value);
    var departure =new Date(prop.value);
    return api.server(["validateDates", arrival.valueOf(), departure.valueOf()])
    .done(function(result) {
    var valid = result.returnValue;
    if(valid ===true) {
    return valid;
    }else{
    prop.errors = [result.returnValue];
    return false;
    }
    });
    }



  • 5.  RE: Identity Portal 14.3 - Validation error

    Posted Aug 06, 2019 08:11 PM
    i check with syntax checker, could not find anything wrong with this code. 


    But in Identity Portal Form Editor, i keep on hitting this error.

    What i triy todo is to build a base validation function, where i copy the sample code and change to my own validation function.


  • 6.  RE: Identity Portal 14.3 - Validation error
    Best Answer

    Broadcom Employee
    Posted Aug 06, 2019 09:58 PM
    Hi William,

    I think I found it. The validate function is auto-closed at the bottom of the import screen.  Remove the closing } from line 13. Here's is your code:


    Note closing } at the bottom. Here it is working:


    ------------------------------
    Broadcom
    ------------------------------



  • 7.  RE: Identity Portal 14.3 - Validation error

    Posted Aug 06, 2019 10:14 PM
    Thanks Jeremy, you are right, after remove the last "}", no more error :)