Skip to main content

Improve error messaging in JSF2 ajax?

2 replies [Last post]
lincolnbaxter
Offline
Joined: 2008-03-26

If the jsf.ajax.request() call is not located within a form, it currently throws a non-descript error here, stating that els is undefined. I think this could be more descriptive if someone gets a chance to update it:

* @returns String The encoded state for the specified form's input controls.
2811 * @function jsf.getViewState
2812 */
2813 jsf.getViewState = function(form) {
2814 var els = form.elements;
2815 var len = els.length;
2816 var qString = "";
2817 var addField = function(name, value) {
2818 if (qString.length > 0) {
2819 qString += "&";
2820 }

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rogerk
Offline
Joined: 2004-05-06

Okay. We should probably check for the form arg as being defined, and if it is not, throw an error - and this behavior should be spec'd as well.

rogerk
Offline
Joined: 2004-05-06

In the mean time, I have made it a spec requirment that jsf.ajax.request be used within the context of a form.