As a "workaround" I've implemented a form validator, as this was a way
to access the raw input. in case anybody is interested, find the source
below.
I am pretty sure, that there are others out there, that need to validate
the rawinput, before any conversion is applied, and do not want to mix
converters with validators, so what about a
FormComponenet.addRawInputValidator ?
Cheers,
Tom
<source>
package at.schnirkel.wicket.validator;
import org.apache.wicket.markup.html.form.validation.IFormValidator;
import org.apache.wicket.markup.html.form.validation.AbstractFormValidator;
import org.apache.wicket.markup.html.form.FormComponent;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.validation.validator.PatternValidator;
public class RawInputFormValidator extends AbstractFormValidator
implements IFormValidator
{
FormComponent[] formComponents = new FormComponent[1];
PatternValidator patternValidator;
public RawInputFormValidator(FormComponent formComponent, String
pattern)
{
this.formComponents[0] = formComponent;
patternValidator = new PatternValidator(pattern);
}
public FormComponent[] getDependentFormComponents()
{
return formComponents;
}
public void validate(Form form)
{
FormComponent formComponent = formComponents[0];
String rawInput = formComponent.getRawInput();
if (!patternValidator.getPattern().matcher(rawInput).matches())
{
error(formComponent);
}
}
}
</source>
Thomas Lutz schrieb:
hi list !
In my form model bean I've got an attribute of type java.sql.Timestamp.
Unfortunately I've got to perform a regular expression validation on
the input.
Adding a PatternValidator does not work, as first the converter is
called, and afterwards the validators. Within the validator interface
there is no chance to access the raw input, so no chance in
implementing my own validator, and .. too much finals to tweak it in :-).
Is there a way to integrate a "raw input pattern validator" ?
Thanks !
Tom
p.s.: wicket 1.3.3 and no chance to upgrade, need to stay with java
1.4 for another year :-/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]