html element id facility?

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

html element id facility?

Stefan Schmiedl
Hi Nico,

does Iliad have any facility for generating unique element ids
(like nextId in Seaside)?

I've been brooding about how to work with labels and checkboxes
being used in a list of multiple choice questions.

Thanks,
s.


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: html element id facility?

Nicolas Petton
Le vendredi 26 juin 2009 à 09:23 +0200, Stefan Schmiedl a écrit :
> Hi Nico,
>

Hi Stefan,


> does Iliad have any facility for generating unique element ids
> (like nextId in Seaside)?
>

Yes, you can use Iliad.Id or Iliad.Session>>nextId

e div id: self session nextId.
e div id: Id new.

> I've been brooding about how to work with labels and checkboxes
> being used in a list of multiple choice questions.

Maybe I should write something about forms and actions in Iliad?
It basically works like anchors:

| form |
form := e form.
form checkbox
        action: [:boolean | self doSomethingWith: boolean];
        checked: true.
form button
        text: 'submit'

Cheers!

Nico

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

signature.asc (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re: html element id facility?

Stefan Schmiedl
On Fri, 26 Jun 2009 12:42:37 +0200
Nicolas Petton <[hidden email]> wrote:

> Le vendredi 26 juin 2009 à 09:23 +0200, Stefan Schmiedl a écrit :
> > Hi Nico,
> >
>
> Hi Stefan,
>
>
> > does Iliad have any facility for generating unique element ids
> > (like nextId in Seaside)?
> >
>
> Yes, you can use Iliad.Id or Iliad.Session>>nextId
>
> e div id: self session nextId.
> e div id: Id new.
Will I break something if I stupidly mix these two different ways?

>
> > I've been brooding about how to work with labels and checkboxes
> > being used in a list of multiple choice questions.
>
> Maybe I should write something about forms and actions in Iliad?

You can write whatever you want on Iliad, I'll read it :-)

> It basically works like anchors:
>
> | form |
> form := e form.
> form checkbox
> action: [:boolean | self doSomethingWith: boolean];
> checked: true.
> form button
> text: 'submit'

I am coming to this later today .-)

My current plan is to _not_ use any forms, instead have every
radiobutton submit a request to the server after being activated.
Probably some
        e radioButton onChange: [...]
thing I assume.

On a side note:

I'll have lots of places showing things like

  6*9=42   o true   o false   o don't know

hence I feel the strong need for collecting label and radiobutton into
a single object, which would be descendant of Element, right?
Ideally, I'll end today having code like

  [:e |
    e text: '6*9=42'.
    model answers do: [ :a |
      e radioButton: a label; onChange: [ whatever: a value ]
    ]
  ]
 

Thanks,
s.

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re: html element id facility?

Nicolas Petton
Le vendredi 26 juin 2009 à 13:02 +0200, Stefan Schmiedl a écrit :

> On Fri, 26 Jun 2009 12:42:37 +0200
> Nicolas Petton <[hidden email]> wrote:
>
> > Le vendredi 26 juin 2009 à 09:23 +0200, Stefan Schmiedl a écrit :
> > > Hi Nico,
> > >
> >
> > Hi Stefan,
> >
> >
> > > does Iliad have any facility for generating unique element ids
> > > (like nextId in Seaside)?
> > >
> >
> > Yes, you can use Iliad.Id or Iliad.Session>>nextId
> >
> > e div id: self session nextId.
> > e div id: Id new.
>
> Will I break something if I stupidly mix these two different ways?
no :)

>
> >
> > > I've been brooding about how to work with labels and checkboxes
> > > being used in a list of multiple choice questions.
> >
> > Maybe I should write something about forms and actions in Iliad?
>
> You can write whatever you want on Iliad, I'll read it :-)
>
> > It basically works like anchors:
> >
> > | form |
> > form := e form.
> > form checkbox
> > action: [:boolean | self doSomethingWith: boolean];
> > checked: true.
> > form button
> > text: 'submit'
>
> I am coming to this later today .-)
>
> My current plan is to _not_ use any forms, instead have every
> radiobutton submit a request to the server after being activated.
> Probably some
> e radioButton onChange: [...]
> thing I assume.
>
> On a side note:
>
> I'll have lots of places showing things like
>
>   6*9=42   o true   o false   o don't know
>
> hence I feel the strong need for collecting label and radiobutton into
> a single object, which would be descendant of Element, right?
> Ideally, I'll end today having code like
>
>   [:e |
>     e text: '6*9=42'.
>     model answers do: [ :a |
>       e radioButton: a label; onChange: [ whatever: a value ]
>     ]
>   ]
In the latest revision (I changed the implementation of radio buttons),
something like this should work :

| form |
form := e form.
model answers do: [:each |
        form radioButton
                group: 'answers';
                action: [self whatever: each].
        form text: each; break]

About the submit on change, there are two possibilities right now:

1. use onChange: 'submit()', but it won't use an AJAX request
2. use onChange:
'Iliad.evaluateFormAction(jQuery(this).closest("form"))'

I know, the latest is tricky...

Cheers!

Nico

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

signature.asc (204 bytes) Download Attachment