Topic
  • 3 replies
  • Latest Post - ‏2013-10-18T15:16:25Z by MikeAA
magic798
magic798
38 Posts

Pinned topic ValidationError when performing Search

‏2013-10-17T15:39:12Z |

Hi,

 

we're developing a requestfilter plugin on "/cm/search" that checks for example if certain fields contain a certain value. If they are not filled in properly then an error is returned and ICN should render a validation error, similar to what happens when we save a document and validation fails.

The JSON containing the error that we're returning is:

 

{"fieldErrors":[{"symbolicName":"KlantID_TR5_15","errorMessage":"Klant should contain value A, B or C!"}]} 

However this has no effect. It simply shows 0 search results and no error is displayed.

My question is: what exactly should the response from the requestfilter be such that the search is aborted and the field mentioned shows a validation error?

 

Kind regards,

 

magic798

  • BJOwings
    BJOwings
    185 Posts

    Re: ValidationError when performing Search

    ‏2013-10-17T18:12:21Z  

    The fieldErrors is not looked for on a response from the search.  (This is used for field validation by EDS which is not supported on search.)  So, displaying an error on a particular field will not work.  Instead, you can display an error dialog using a normal error response:

    
    {"errors":[{"text": "Invalid value", "explanation":"Klant should contain value A, B, or C!
    ","number":"10001","userResponse":"Enter a valid value for Klant"}]}
    

    The choice of error number is yours, but you should choose one out of the range of ICN's errors.

  • magic798
    magic798
    38 Posts

    Re: ValidationError when performing Search

    ‏2013-10-18T10:04:37Z  
    • BJOwings
    • ‏2013-10-17T18:12:21Z

    The fieldErrors is not looked for on a response from the search.  (This is used for field validation by EDS which is not supported on search.)  So, displaying an error on a particular field will not work.  Instead, you can display an error dialog using a normal error response:

    <pre dir="ltr" role="list"> {"errors":[{"text": "Invalid value", "explanation":"Klant should contain value A, B, or C! ","number":"10001","userResponse":"Enter a valid value for Klant"}]} </pre>

    The choice of error number is yours, but you should choose one out of the range of ICN's errors.

    Hi Brian,

    thank you, this works!

    The error numbers I could find were in a different format, like "DLG2425A". Could you tell us where we can find a list of ICN error codes and their meanings?

    Have a nice weekend! :)

    Kind regards,

    magic798

  • MikeAA
    MikeAA
    6 Posts

    Re: ValidationError when performing Search

    ‏2013-10-18T15:16:25Z  
    • magic798
    • ‏2013-10-18T10:04:37Z

    Hi Brian,

    thank you, this works!

    The error numbers I could find were in a different format, like "DLG2425A". Could you tell us where we can find a list of ICN error codes and their meanings?

    Have a nice weekend! :)

    Kind regards,

    magic798

    DLG2425A is from the Content Manager repository.  The CM8 error codes can be found in the Infocenter under the "Troubleshooting and Support" section.   Content Navigator error codes can also be found in the CM8 Infocenter under