Skip to content
This repository has been archived by the owner on Oct 4, 2020. It is now read-only.

Commit

Permalink
Removed form validator.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Tilford committed Apr 12, 2010
1 parent 1c6d969 commit 2682567
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 175 deletions.
78 changes: 0 additions & 78 deletions core/src/main/java/wicket/validation/BeanFormValidator.java

This file was deleted.

47 changes: 0 additions & 47 deletions demo/src/main/java/wicket/validation/demo/HomePage.html
Expand Up @@ -54,52 +54,5 @@ <h1>BeanValidator</h1>
<input wicket:id="submit" type="submit" value="Submit"/>
</form>


<form wicket:id="formValidator">

<h1>BeanFormValidator</h1>

<div wicket:id="feedback"/>


<label for="name2">
<wicket:message key="person.name">Name</wicket:message>
</label>
<input wicket:id="name" name="name2"/>
<br/>
<label for="address.lineOne2">
<wicket:message key="address.lineOne">Address</wicket:message>
</label>
<input wicket:id="address.lineOne" name="address.lineOne2"/>
<input wicket:id="address.lineTwo" name="address.lineTwo2"/>
<br/>

<label for="address.city2">
<wicket:message key="address.city">City</wicket:message>
</label>
<input wicket:id="address.city" name="address.city2"/>
<br/>

<label for="address.region2">
<wicket:message key="address.region">State</wicket:message>
</label>
<input wicket:id="address.region" name="address.region2"/>
<br/>

<label for="address.country2">
<wicket:message key="address.country">Country</wicket:message>
</label>
<input wicket:id="address.country" name="address.country2"/>
<br/>

<label for="address.postalCode2">
<wicket:message key="address.postalCode">Zip Code</wicket:message>
</label>
<input wicket:id="address.postalCode" name="address.postalCode2"/>
<br/>

<input wicket:id="submit" type="submit" value="Submit"/>
</form>

</body>
</html>
50 changes: 0 additions & 50 deletions demo/src/main/java/wicket/validation/demo/HomePage.java
Expand Up @@ -9,10 +9,8 @@
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.Model;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import wicket.validation.BeanFormValidator;
import wicket.validation.demo.beans.Address;
import wicket.validation.demo.beans.Person;

Expand Down Expand Up @@ -62,53 +60,5 @@ public void onSubmit() {
this.add(personForm);


final Person person2 = new Person();
person2.setAddress(new Address());
final TextField<String> name = new TextField<String>("name", Model.of(person2.getName()));
final TextField<String> addressLineOne = new TextField<String>("address.lineOne", Model.of(person2.getAddress().getLineOne()));
final TextField<String> addressLineTwo = new TextField<String>("address.lineTwo", Model.of(person2.getAddress().getLineTwo()));
final TextField<String> addressCity = new TextField<String>("address.city", Model.of(person2.getAddress().getCity()));
final TextField<String> addressRegion = new TextField<String>("address.region", Model.of(person2.getAddress().getRegion()));
final TextField<String> addressCountry = new TextField<String>("address.country", Model.of(person2.getAddress().getCountry()));
final TextField<String> addressPostalCode = new TextField<String>("address.postalCode", Model.of(person2.getAddress().getPostalCode()));


final Form<Person> formValidator = new Form<Person>("formValidator", Model.of(person2)) {


@Override
protected void onValidate() {
this.getModelObject().setName(name.getValue());
this.getModelObject().getAddress().setLineOne(addressLineOne.getValue());
this.getModelObject().getAddress().setLineTwo(addressLineTwo.getValue());
this.getModelObject().getAddress().setCity(addressCity.getValue());
this.getModelObject().getAddress().setRegion(addressRegion.getValue());
this.getModelObject().getAddress().setCountry(addressCountry.getValue());
this.getModelObject().getAddress().setPostalCode(addressPostalCode.getValue());

super.onValidate(); //To change body of overridden methods use File | Settings | File Templates.
}

@Override
protected void onSubmit() {

info("No Errors");
}
};
formValidator.add(BeanFormValidator.create(Person.class));

formValidator.add(new FeedbackPanel("feedback", new ContainerFeedbackMessageFilter(formValidator)));
formValidator.add(
name,
addressLineOne,
addressLineTwo,
addressCity,
addressRegion,
addressCountry,
addressPostalCode,
new Button("submit"));

this.add(formValidator);

}
}

0 comments on commit 2682567

Please sign in to comment.