Iterator fieldsIterator = validator.getFieldsIterator();
boolean firstField = true;
while (fieldsIterator.hasNext()) {
FieldAttributes fieldAttributes = (FieldAttributes) fieldsIterator.next();
// Get attributes of refered input element.
String inputId = fieldAttributes.getRef();
XFFormFieldAttributes formFieldAttributes = actualProtocol.getFormFieldAttributes(inputId);
// If no attributes were found, it means that the refered text
// input field
// does not exist. In that case, don't render it.
if (formFieldAttributes != null) {
// Render comma, if this is not the first rendered field.
if (!firstField) {
scriptWriter.write(", ");
}
// Get styles of the input element.
stylesExtractor.setStyles(formFieldAttributes.getStyles());
stylesExtractor.setPseudoClass(null);
// Render field name, which equals to ID of the input
// element.
scriptWriter.write(createJavaScriptString(inputId) + ":{");
// Render ID of the input element.
scriptWriter.write("inputId: " + createJavaScriptString(inputId));
// Render message area for field, if 'message' was specified
// as one of the validation error actions.
boolean displayMessages = stylesExtractor
.containsMessageValidationErrorAction();
if (displayMessages) {
String messageId = fieldAttributes.getMessageArea();
if (messageId != null) {
scriptWriter.write(", messageAreaId: " + createJavaScriptString(messageId));
}
}