// is used as a part of simple or multiple validator.
validateAttributes
.setMultiple(parent instanceof MultipleValidatorElement);
if (parent instanceof XFInputElementImpl) {
MCSAttributes inputAttributes = ((XFInputElementImpl) parent)
.getProtocolAttributes();
// If input element does not have an ID, generate it now,
// because JavaScript Widget.SimpleValidator class needs
// to use it as a reference
if (inputAttributes.getId() == null) {
inputAttributes.setId(getProtocol(context)
.getMarinerPageContext().generateUniqueFCID());
}
// Store the ID in validate attributes, for easy access.
validateAttributes.setInputElementId(inputAttributes.getId());
// temporarily changed (VMS-321) and implemented in javascript as event type should depends on device policy
// which will say if browser supports mouse cursor or not.
// For exmple for NetFront3.4 in SE K660i onblur will be replaced with onmouseout
// Empty events attribute will be rendered and will be filled in javascript
if (validateAttributes.isAuto()) {
// This needs to be done using timers, because without timers the autoFocus feature does not work.
// String validateString = "setTimeout(function(){Widget.getInstance('"
// + validateAttributes.getId() + "').validate()}, 0)";
String validateString = "";
inputAttributes.getEventAttributes(true).setEvent(
EventConstants.ON_BLUR, validateString);
inputAttributes.getEventAttributes(true).setEvent(
EventConstants.ON_MOUSE_OUT, validateString);
}
// Set up the styles extractor to extract the MCS_INVALID value. Set
// that value in the
// ValidateAttributes object so that the extractor can use the value
// when it is run. The
// value used here is from a pseduoclass.
// Extract styles from 'mcs-invalid' pseudo-class,
// to be used to emphasise validation errors.
StylesExtractor stylesExtractor =
WidgetHelper.createStylesExtractor(null, inputAttributes.getStyles());
stylesExtractor.setPseudoClass(StatefulPseudoClasses.MCS_INVALID);
String invalidStyles = stylesExtractor.getJavaScriptStyles();
validateAttributes.setInvalidStyle(invalidStyles);