Thank you Gerolf,

I know there is one form (in conformance to HTML specs), I just
thought that when using ajax the form may be submitted partially using
some smart neat trick, but thank you for bringing be back to reality
;)

We'll try to overcome it in a different way. Put the file uploads in a
separate form (or a whole component with a form) put it somewhere in a
hidden div and show it on top just to send one of the files, then just
show the already uploaded files name in the main form ...
theoretically should ... or would it be better to rewrite the whole
dynamic list component to use AjaxFormComponentUpdatingBehavior? but
then this behaviour will have to validate those values? otherwise it
can't update the model because there may be trash strings there,

and that reminds me of my earlier question :): what about retaining
the user input without validating it ?

Thank you all for your help!

regards
Wojtek

2008/3/6, Gerolf Seitz <[EMAIL PROTECTED]>:
> Wojtek,
>
>  using nested forms, there's always exactly one form tag.
>  submitting a nested form results in submitting the entire form,
>  but only processing (converting, validating, updating models)
>  the nested form on the server side.
>
>  bringing in a fileupload field basically takes away the ability to
>  submit the form via ajax.
>  having said that, an AjaxFormComponentUpdatingBehavior should still work.
>
>  cheers,
>
>   Gerolf
>
>
>
>  On Thu, Mar 6, 2008 at 2:19 PM, Wojciech Biela <[EMAIL PROTECTED]> wrote:
>
>  > Hello Maurice,
>  >
>  > We just (almost) implemented this component (as I wrote in response to
>  > Erik's post), but we're are now struggling with not processing the
>  > form and retaining user input
>  >
>  > other than that I have the same wondering, if I submit only the inner
>  > form, will the browser send the whole form, or will the AjaxSubmitLink
>  > only submit the part I'm interested in? It's quite important because I
>  > will have fileiupload fields in the the outer form, so then adding an
>  > item to this listview (and sending this little form) will cause the
>  > browser to send the whole form with heavy files ... that would be
>  > absurd
>  >
>  > how does it work in wicket 1.3.1? or do I have to get a sniffer to be
>  > sure?
>  >
>  > regards
>  > Wojtek
>  >
>  > 2008/3/5, Maurice Marrink <[EMAIL PROTECTED]>:
>  > > Actually AjaxFormComponentUpdatingBehavior accomplishes the desired
>  > >  behavior without submitting the entire form. I can see the tricky part
>  > >  in loosing changes to the text in the textfields if you replace the
>  > >  div surrounding them but i thought nested forms in wicket 1.3.? solved
>  > >  this by only submitting the child formcomponents, or am i mistaken?
>  > >
>  > >
>  > >  Maurice
>  > >
>  > >
>  > >  On Wed, Mar 5, 2008 at 4:50 PM, Erik van Oosten <[EMAIL PROTECTED]>
>  > wrote:
>  > >  > Hi Wojciech,
>  > >  >
>  > >  >  You should use Buttons instead of links. Button (or
>  > AjaxFallbackButton)
>  > >  >  does submit the form. The only thing you need to do is disable
>  > >  >  validation on the button (call button.setDefaultFormProcessing
>  > (false)),
>  > >  >  otherwise the onSubmit of the button is not called when some field
>  > in
>  > >  >  the form does not validate. You can optionally call form.validate()
>  > in
>  > >  >  the onSubmit of the button so that validation messages do not
>  > disappear.
>  > >  >
>  > >  >  OT: personally, in forms I prefer RefreshingView instead of
>  > ListView.
>  > >  >
>  > >  >  Regards,
>  > >  >     Erik.
>  > >  >
>  > >  >  --
>  > >  >  Erik van Oosten
>  > >  >  http://www.day-to-day-stuff.blogspot.com/
>  > >  >
>  > >  >
>  > >  >
>  > >  >
>  > >  >  Wojciech Biela wrote:
>  > >  >  > Hello
>  > >  >  >
>  > >  >  > This time my question is not so general.
>  > >  >  >
>  > >  >  > We have a big form, part of this form there is a component which
>  > >  >  > should be a dynamic list of fields like this:
>  > >  >  >
>  > >  >  > |TextField| - remove
>  > >  >  > |TextField| - remove
>  > >  >  > |TextField| - remove
>  > >  >  > |TextField| - add
>  > >  >  >
>  > >  >  > if you click "add" another row "|TextField| - remove" should
>  > appear at
>  > >  >  > the bottom, it you should click "remove" then this row should be
>  > >  >  > removed
>  > >  >  >
>  > >  >  > problem we have is that the "add" and "remove" link does not send
>  > the
>  > >  >  > form, it only sends and ajax request to add an element to the list
>  > of
>  > >  >  > components and it operates (target) on a DIV that wraps the whole
>  > >  >  > list, so afterwards it renders the list again loosing values that
>  > were
>  > >  >  > already put in
>  > >  >  >
>  > >  >  > what is the preferred method to do such a thing? should the add
>  > and
>  > >  >  > remove link be a submit link with defaultFormProcessing set to
>  > false?
>  > >  >  > or maybe should we try to save values to model objects onchange in
>  > the
>  > >  >  > respective fields themselves
>  > >  >  >
>  > >  >  > isn't there a way to do it in a neat fashion?
>  > >  >  >
>  > >  >  > code responsible for the list component is
>  > >  >  >
>  > >  >  >     wrapper = new WebMarkupContainer("attributes-wrapper");
>  > >  >  >     listView = new ListView("attributes", attributeValuesList) {
>  > >  >  >       public void populateItem(final ListItem listItem) {
>  > >  >  >         final AttributeValue attributeValue = (AttributeValue)
>  > >  >  > listItem.getModelObject();
>  > >  >  >         Renderer inputRenderer =
>  > >  >  > attributeValue.getAttribute().getInputRenderer();
>  > >  >  >         Component component = inputRenderer.getComponent
>  > (attributeValue);
>  > >  >  >         listItem.add(component);
>  > >  >  >         AjaxLink addLink = new AddLink("add-link");
>  > >  >  >         AjaxLink removeLink = new RemoveLink("remove-link",
>  > listItem);
>  > >  >  >         if (listItem.getIndex() < (listView.getViewSize() - 1)) {
>  > >  >  >           addLink.setVisible(false);
>  > >  >  >         } else {
>  > >  >  >           removeLink.setVisible(false);
>  > >  >  >         }
>  > >  >  >         listItem.add(addLink);
>  > >  >  >         listItem.add(removeLink);
>  > >  >  >       }
>  > >  >  >     };
>  > >  >  >     wrapper.setOutputMarkupId(true);
>  > >  >  >
>  > >  >  > HTML is
>  > >  >  >
>  > >  >  >       <div wicket:id="attributes-wrapper"
>  > class="composit-wrapper">
>  > >  >  >               <div wicket:id="attributes" class="composit">
>  > >  >  >                       <div wicket:id="attributeAndValue"
>  > class="composit-item"></div>
>  > >  >  >                       <div class="composit-links">
>  > >  >  >                       <a wicket:id="add-link">+ add</a>
>  > >  >  >                       <a wicket:id="remove-link">- remove</a>
>  > >  >  >                       </div>
>  > >  >  >               </div>
>  > >  >  >       </div>
>  > >  >  >
>  > >  >  >
>  > >  >
>  > >  >
>  > >  >
>  > >  >
>  > >  > ---------------------------------------------------------------------
>  > >  >  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]
>  >
>  >
>


-- 
Wojtek Biela

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to