The wonderful world of the single form per page

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The wonderful world of the single form per page

Bernat Romagosa
Hi list!

I have an object that is tagged in a linear way, similar to file paths in HFS (i.e. #programming→#javascript→#api).

I'm trying to build a widget that displays a text input which autocompletes with the next possible tag to be added and keeps updating the tag chain until the user decides to submit it.

But here's my problem: if I use an ILFormula autoCompleteInput, the form is submitted every time a new tag is added, while I would like it to only update the tag chain, not submit itself...

I don't know whether I explained myself very well, so here's a pic of what I'm imagining: http://i.imgur.com/bHHLs.png

What would be the right way to do this in Iliad? I've been trying different approaches for two days now and I'm completely clueless... :(

Thanks!

--
Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: The wonderful world of the single form per page

Nicolas Petton
Hi!

I don't think formula can handle that out of the box.

I would write a custom widget form that add to a collection of tags the
user input on form submission, and mark the widget dirty, to rebuild it.

MyFormWidget >> contents
        ^[:e |
                e form input
                        value: (self tags
                                inject: ''
                                into: [:acc :each | acc, '::', each])
                        action: [:val |
                                self addTag: val].
                ...
                ...]

MyFormWidget >> addTag: aString
        aString ifNotEmpty: [self tags add: aString]

That + jQuery autocomplete could be a good solution IMO. Would that work
for you?

Cheers,
Nico

On Fri, 2012-01-27 at 15:46 +0100, Bernat Romagosa wrote:

> Hi list!
>
>
> I have an object that is tagged in a linear way, similar to file paths
> in HFS (i.e. #programming→#javascript→#api).
>
>
> I'm trying to build a widget that displays a text input which
> autocompletes with the next possible tag to be added and keeps
> updating the tag chain until the user decides to submit it.
>
>
> But here's my problem: if I use an ILFormula autoCompleteInput, the
> form is submitted every time a new tag is added, while I would like it
> to only update the tag chain, not submit itself...
>
>
> I don't know whether I explained myself very well, so here's a pic of
> what I'm imagining: http://i.imgur.com/bHHLs.png
>
>
> What would be the right way to do this in Iliad? I've been trying
> different approaches for two days now and I'm completely
> clueless... :(
>
>
> Thanks!
>
>
> --
> Bernat Romagosa.
>


Reply | Threaded
Open this post in threaded view
|

Re: The wonderful world of the single form per page

Bernat Romagosa
Hi Nico,

We finally decided to use an ILAutocompleteField that fires up an announcement when a new tag is entered, then the main form adds this tag to its tag collection, marks itself dirty and only saves the collection upon form submission.

It's so true that events fix most of your coupling troubles when you don't know where else to look :)

Thanks!

2012/2/3 Nicolas Petton <[hidden email]>
Hi!

I don't think formula can handle that out of the box.

I would write a custom widget form that add to a collection of tags the
user input on form submission, and mark the widget dirty, to rebuild it.

MyFormWidget >> contents
       ^[:e |
               e form input
                       value: (self tags
                               inject: ''
                               into: [:acc :each | acc, '::', each])
                       action: [:val |
                               self addTag: val].
               ...
               ...]

MyFormWidget >> addTag: aString
       aString ifNotEmpty: [self tags add: aString]

That + jQuery autocomplete could be a good solution IMO. Would that work
for you?

Cheers,
Nico

On Fri, 2012-01-27 at 15:46 +0100, Bernat Romagosa wrote:
> Hi list!
>
>
> I have an object that is tagged in a linear way, similar to file paths
> in HFS (i.e. #programming→#javascript→#api).
>
>
> I'm trying to build a widget that displays a text input which
> autocompletes with the next possible tag to be added and keeps
> updating the tag chain until the user decides to submit it.
>
>
> But here's my problem: if I use an ILFormula autoCompleteInput, the
> form is submitted every time a new tag is added, while I would like it
> to only update the tag chain, not submit itself...
>
>
> I don't know whether I explained myself very well, so here's a pic of
> what I'm imagining: http://i.imgur.com/bHHLs.png
>
>
> What would be the right way to do this in Iliad? I've been trying
> different approaches for two days now and I'm completely
> clueless... :(
>
>
> Thanks!
>
>
> --
> Bernat Romagosa.
>





--
Bernat Romagosa.