Re: [xwiki-devs] Tutorial to write validations and tooltips in forms
Regarding the very helpful tutorial at XWiki - DevGuide - Creating a form with validation and tooltips<http://platform.xwiki.org/xwiki/bin/view/DevGuide/Creating+a+form+with+validation+and+tooltips>I've noticed a situation where it was expecting an int and had an error if it was given text instead: http://localhost:8080xwiki/bin/view/ValidationSample/ -> I fill In form with first_name: jar last_name: jar age: binks emal: binks@jarjar.com usphone: 123-456-7890 text: poipoipoipoipoi -> click create, which brings me to http://localhost:8080/xwiki/bin/view/ValidationSample/CreateDoc : CreateDoc ________________________________ Error number 4001 in 4: Error while parsing velocity page ValidationSample.CreateDoc Wrapped Exception: Invocation of method 'updateObjectFromRequest' in class com.xpn.xwiki.api.Document threw exception java.lang.NumberFormatException: For input string: "binks" @ ValidationSample.CreateDoc6,20? How to trap this type exception in the validation code itself? Input type-checking is why validation is needed in the first place. -- Niels Mayer ( http://http://www.curriki.org/xwiki/bin/view/XWiki/NielsMayer) Curriki: The Global Education & Learning Community
Niels Mayer wrote:
Regarding the very helpful tutorial at XWiki - DevGuide - Creating a form with validation and tooltips<http://platform.xwiki.org/xwiki/bin/view/DevGuide/Creating+a+form+with+validation+and+tooltips>I've noticed a situation where it was expecting an int and had an error if it was given text instead:
http://localhost:8080xwiki/bin/view/ValidationSample/
-> I fill In form with first_name: jar last_name: jar age: binks emal: binks@jarjar.com usphone: 123-456-7890 text: poipoipoipoipoi
-> click create, which brings me to http://localhost:8080/xwiki/bin/view/ValidationSample/CreateDoc : CreateDoc ________________________________ Error number 4001 in 4: Error while parsing velocity page ValidationSample.CreateDoc Wrapped Exception: Invocation of method 'updateObjectFromRequest' in class com.xpn.xwiki.api.Document threw exception java.lang.NumberFormatException: For input string: "binks" @ ValidationSample.CreateDoc6,20?
How to trap this type exception in the validation code itself? Input type-checking is why validation is needed in the first place.
That is http://jira.xwiki.org/jira/browse/XWIKI-1491 -- Sergiu Dumitriu http://purl.org/net/sergiu/
participants (2)
-
Niels Mayer -
Sergiu Dumitriu