new PropertyModel(this, "photoId")
On 4/2/08, Michael Mehrle <[EMAIL PROTECTED]> wrote:
> Okay, here's the code - I changed the hidden field to a textfield, for
> debugging...
>
> private final class SubmitForm extends MyForm {
> String photoId;
>
> public SubmitForm(String id, IModel model) {
> super(id, model);
>
> // This is actually being set by a JavaScript (jQuery based)
> function after a
> // successful file upload inside the modal.
> final TextField hidden;
> add(hidden = new TextField("hiddenPhotoId", new
> Model(photoId)));
> hidden.setOutputMarkupId(true);
>
> add(new AjaxButton("save", SubmitForm.this) {
> @Override
> protected void onSubmit(AjaxRequestTarget target, Form
> form) {
> modalWindow.setWindowClosedCallback(new
> ModalWindow.WindowClosedCallback() {
> public void onClose(AjaxRequestTarget target) {
> LOG.debug("Photo ID: {}",
> hidden.getModelObjectAsString());
> }
> });
> target.addComponent(hidden);
> modalWindow.close(target);
> }
> });
> }
> }
> }
>
> -----Original Message-----
> From: Maurice Marrink [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 02, 2008 3:05 PM
> To: [email protected]
> Subject: Re: Setting wicket field component model via JavaScript
>
> Could you show us the rest of the relevant code?
>
> Maurice
>
> On Thu, Apr 3, 2008 at 12:02 AM, Michael Mehrle <[EMAIL PROTECTED]>
> wrote:
> > Right, I did try that but it's always null. I'm pretty sure I have the
> > model set properly:
> >
> > String id;
> >
> > add(new HiddenField("hidden", new Model(id)));
> >
> > then there's the AjaxButton etc.
> >
> > Not sure what's going on there, it seems very simple but something's
> > broken.
> >
> >
> > -----Original Message-----
> > From: Maurice Marrink [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, April 02, 2008 2:50 PM
> > To: [email protected]
> >
> >
> > Subject: Re: Setting wicket field component model via JavaScript
> >
> > I assume you have a form inside your modalwindow and update the value
> > serverside with an AjaxSubmit- Link or Button ?
> >
> > Then you should be able to get the field's value using
> > field.getModelObject().
> >
> > Maurice
> >
> > On Wed, Apr 2, 2008 at 11:22 PM, Michael Mehrle
> <[EMAIL PROTECTED]>
> > wrote:
> > > Anyone? Could use a pointer...
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Michael Mehrle [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, April 02, 2008 11:42 AM
> > > To: [email protected]
> > > Subject: Setting wicket field component model via JavaScript
> > >
> > > Simple scenario: I've got a hidden wicket field which I'm setting
> > with
> > > JavaScript to a value like this:
> > >
> > > hiddenField.value = data.msg;
> > >
> > > When I pop up a JS alert it seems the value is set.
> > >
> > > However, back on the Java side I'm trying to log the field's value
> in
> > my
> > > onClose() method as part of a SetWindowClosedCallback, but the
> model
> > of
> > > the wicket component still is null:
> > >
> > > LOG.debug("Value: {}", hiddenField.getRawInput));
> > >
> > > Obviously I'm missing something in terms of the flow here. How can
> I
> > get
> > > the field's component to be updated?
> > >
> > > Any help would be appreciated.
> > >
> > > Thanks,
> > >
> > > Michael
> > >
> > >
> ---------------------------------------------------------------------
> > > 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]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > 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]
> >
> >
>
> ---------------------------------------------------------------------
> 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]
>
>
--
Ryan Gravener
http://ryangravener.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]