You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by gatalaylaz <ga...@gmail.com> on 2012/07/18 18:15:22 UTC
button submit
Dear,
Any body can help me? I have a issue, the button submit is doesn't call when
the program is running. Bellow in send my code.
private class InputForm extends Form<InRole> {
/**
*
*/
private static final long serialVersionUID = 1L;
public InputForm(String id) {
super(id, new CompoundPropertyModel<InRole>(new InRole()));
add(new TextField<Integer>("idAplicacao",
Integer.class).setRequired(true).add(
new RangeValidator<Integer>(1, Integer.MAX_VALUE)));
add(new TextField<String>("descricao").setLabel(new
Model<String>("String")));
add(new TextField<String>("name").setRequired(true).setLabel(new
Model<String>("String")));
System.out.println(" ************* before saveButton ************");
Button saveButton = new Button("saveButton") {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void onSubmit() {
System.out.println(" ************* onSubmit ************");
resp = inserirRegra((InRole) getDefaultModelObject());
info("button1.onSubmit executed");
}
};
add(saveButton);
}
}
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/button-submit-tp4650594.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: button submit
Posted by delta458 <de...@hotmail.com>.
Oh the solution is validation.
ONLY when you have a validated form (all inputs are inserted) then the
submit button will be called.
You can add a feedback panel, which will help you:
in JAVA:
form.add(new FeedbackPanel("feedback"));
in HTML:
<form>
...
...
</form>
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/button-submit-tp4650594p4652941.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: button submit
Posted by Dan Retzlaff <dr...@gmail.com>.
Are you sure your validators are passing? A validation error will prevent
onSubmit from being called.
If you don't care which button submits the form, you should override
Form#onSubmit instead. That way you'll get a callback even if the user
submits with the enter key.
Also note the presence of Button#onError and Form#onError.
On Wed, Jul 18, 2012 at 9:15 AM, gatalaylaz <ga...@gmail.com> wrote:
> Dear,
>
> Any body can help me? I have a issue, the button submit is doesn't call
> when
> the program is running. Bellow in send my code.
>
> private class InputForm extends Form<InRole> {
>
> /**
> *
> */
> private static final long serialVersionUID =
> 1L;
>
> public InputForm(String id) {
> super(id, new CompoundPropertyModel<InRole>(new
> InRole()));
>
> add(new TextField<Integer>("idAplicacao",
> Integer.class).setRequired(true).add(
> new RangeValidator<Integer>(1,
> Integer.MAX_VALUE)));
>
> add(new TextField<String>("descricao").setLabel(new
> Model<String>("String")));
>
> add(new
> TextField<String>("name").setRequired(true).setLabel(new
> Model<String>("String")));
>
> System.out.println(" ************* before
> saveButton ************");
>
>
> Button saveButton = new Button("saveButton") {
> /**
> *
> */
> private static final long
> serialVersionUID = 1L;
>
> @Override
> public void onSubmit() {
> System.out.println(" *************
> onSubmit ************");
> resp = inserirRegra((InRole)
> getDefaultModelObject());
> info("button1.onSubmit executed");
> }
> };
>
> add(saveButton);
>
> }
>
> }
>
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/button-submit-tp4650594.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: button submit
Posted by delta458 <de...@hotmail.com>.
I have the same problem: the onSubmit() will not be executed...
*
/Here is the constructor in my java file:/*
public RechnungsformularNEW() {
setPageTitle("Rechnung");
CompoundPropertyModel<Rechnung> formModel = new
CompoundPropertyModel<Rechnung>(new Rechnung());
* Form<Rechnung> form = new Form("inputForm", formModel) {
@Override
public void onSubmit(){
System.out.println("Submitted!");
}
};*
form.add(new
TextField<String>("Empfänger").setRequired(true).setLabel(
new Model<String>("String")));
form.add(new
TextField<String>("Details").setRequired(true).setLabel(
new Model<String>("String")));
form.add(new TextField<Double>("Preis",
Double.class).setRequired(true));
RadioChoice<String> rc = new RadioChoice<String>("Steuersatz",
NUMBERS).setSuffix("");
rc.setLabel(new Model<String>("number"));
rc.setRequired(true);
form.add(rc);
add(form);
}
*/Here is the HTML file:/*
<form wicket:id="inputForm">
<fieldset>
<label for="Empfänger">Empfänger</label>
<input wicket:id="Empfänger" id="Empfänger"
type="text" size="40"/>
<br />
<label for="Details">Rechnungdetails</label>
<input wicket:id="Details" id="Details"
type="text" size="40"/>
<br />
<label for="Preis">Preis</label>
<input wicket:id="Preis" id="Preis"
type="text" size="40"/>
<br />
<label for="steuersatz">Steuersatz</label>
<input type="radio">10%</input>
<input type="radio">20%</input>
* <input type="submit" value="save"/>*
</fieldset>
</form>
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/button-submit-tp4650594p4652940.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org