Form not displaying messages correctly

2013-04-27 Thread Taro Fukunaga
I have a FencedFeedbackPanel inside a form but when I try to display a
message, the form closes and the message is displayed on the main page
instead of in my form. The form is in turn inside a modal window (see
hierarchy below). When I have invalid input, I want my form (and modal
window) to stay open and the error message displayed on that form so that
the user can correct it. 

public class MyForm extends Form {
  public MyForm {
FencedFeedbackPanel feedbackPanel = new FencedFeedbackPanel(
"myFeedbackPanel", this );
feedbackPanel.setOutputMarkupId( true );
add( feedbackPanel );
...
  }
}

I am also using a FormValidator and am adding it to my field for validation.

public class MyForm extends Form {
  public MyForm {
   ...
   final TextField myInput = new TextField( "myInput", new
IModel() {
   add( new MyFormValidator( myInput ) );

The code for MyFormValidator is similar to
http://blog.armstrongconsulting.com/?p=40, except that I'm using a 
TextField instead of a TextArea. Like the example, in my code I am
just saying error() in the validator and am expecting it to display inside
the form.


http://wicket.apache.org";>
  


  

The Hierarchy is like this:

MyPage
  |
MyModalWindow
  |
MyPanel
  |
MyForm
  |
Input Field

I'm using Wicket 6.5

Thank you.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Form-not-displaying-messages-correctly-tp4658351.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Submit button without form component

2013-04-27 Thread Martin Grigorov
Hi,

I haven't tried something like this before and I don't know what exactly
breaks but the simplest solution I see at the moment is to use
StatelessForm.


On Sat, Apr 27, 2013 at 4:01 PM, Bertrand Guay-Paquet <
ber...@step.polymtl.ca> wrote:

> Hello,
>
> I have action links which I want to transform to POST actions since they
> can have side-effects on the database. (See http://stackoverflow.com/**
> questions/679013/get-vs-post-**best-practices)
> My understanding is that this is only possible with either javascript or
> forms.
>
> I decided (for now) to use forms since they're more accessible and easier
> to do while keeping the page stateless. I was hoping to use markup like so:
> 
> do it!
> 
>
> Note that there is only a Button component and no Form. Since the form
> contains only the button, I'd really like to omit it from the component
> hierarchy to keep things simple. Is this possible? I can't get my Buttons
> onSubmit() method called... One part of the problem is that the "action"
> attribute gets changed automatically by Wicket to a relative path to the
> application context root.
>
> Or is there another better way to achieve POSTing in Wicket?
>
> Regards,
> Bertrand
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Martin Grigorov
Wicket Training & Consulting
http://jWeekend.com 


Submit button without form component

2013-04-27 Thread Bertrand Guay-Paquet

Hello,

I have action links which I want to transform to POST actions since they 
can have side-effects on the database. (See 
http://stackoverflow.com/questions/679013/get-vs-post-best-practices) My 
understanding is that this is only possible with either javascript or forms.


I decided (for now) to use forms since they're more accessible and 
easier to do while keeping the page stateless. I was hoping to use 
markup like so:


do it!


Note that there is only a Button component and no Form. Since the form 
contains only the button, I'd really like to omit it from the component 
hierarchy to keep things simple. Is this possible? I can't get my 
Buttons onSubmit() method called... One part of the problem is that the 
"action" attribute gets changed automatically by Wicket to a relative 
path to the application context root.


Or is there another better way to achieve POSTing in Wicket?

Regards,
Bertrand

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Example for saving value edited in Text Box on exit event

2013-04-27 Thread Martin Grigorov
Hi Bruno,

What is the current problem ?
I think your code should work.
But you may either change the event to 'change', 'blur' or 'input' or at
least add throttling (I don't remember the syntax for 1.4) because now it
will fire Ajax event for every typed character.

Ah, and Wicket 1.4/1.5 work with inline attributes so you need the 'on'
prefix -> onkeyup.

On Fri, Apr 26, 2013 at 11:10 PM, Bruno Moura  wrote:

> Hi Martin
>
> I trying to add a TextField in a list view as is showed bellow:
>
> val detail = new TextField("detail", new PropertyModel(objItem,
> "description"))
>   detail.add(new AjaxFormComponentUpdatingBehavior(("keyup")) {
> protected def onUpdate(target: AjaxRequestTarget) {
> objItemDAO.saveObjItem(objItem)
> }
> })
> item.add(detail)
>
> I need to save the object objItem immediately after the user finishes
> editing this. Maybe this component
> coulb be changed by a inline label, but I need to some example that could
> works with wicket 1.4.
>
> Thanks again Martin for your help.
>
>
>
>
> Bruno Moura
>
>
> 2013/4/26 Martin Grigorov 
>
> > Hi,
> >
> > There is no 'exit' event.
> > Please give us more details. And show us what you have so far.
> >
> >
> > On Fri, Apr 26, 2013 at 8:54 PM, Bruno Moura 
> > wrote:
> >
> > > Hi someone please could give me an example for saving value edited in
> > Text
> > > Box, inside a listview, via ajax on exit event.
> > >
> > > I need a example of this implementation for wicket 1.4 and if its
> > possible
> > > in scala.
> > >
> > > Thanks
> > >
> > >
> > >
> > > Bruno Moura
> > >
> >
> >
> >
> > --
> > Martin Grigorov
> > jWeekend
> > Training, Consulting, Development
> > http://jWeekend.com 
> >
>



-- 
Martin Grigorov
Wicket Training & Consulting
http://jWeekend.com