dateInput Question

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

dateInput Question

Ron Teitelbaum

Hello All,

 

I was wondering if you could help me understand something.

 

I’m trying to add a livecallback to dateInput.  It works fine but since I have a liveCallback now the regular callback doesn’t work.

 

I’m trying to understand the following code:

 

canvas hiddenInput

                        callback:

                                    [value := Date

                                                newDay: (day min: (Date daysInMonth: month forYear: year))

                                                monthNumber: month

                                                year: year.

                                    callbackBlock value: value];

                        close.

            canvas forgetCurrentBrush.

 

It all makes sense except the part of what triggers the callback in the first place.  Can someone point me to how this hiddenInput callback is triggered?  I’d like to modify my liveCallbackYear: to call this code and the regular callback code and then my liveCallback block.

 

Ultimately I’m trying to have a date with a field next to it that shows age.  If you change the age it changes the date, and if you change the date it changes the age.  I have the age updating the date just fine.  Now I need the date changes updating the age.

 

Thanks for your help!

 

Ron Teitelbaum


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: dateInput Question

Michel Bany
Hi Ron,

I was wondering if you could help me understand something.

You do not provide enough background information.
Are you using Squeak or VW ?
Are you using SeasideAsynx of Scriptaculous ?

I’m trying to add a livecallback to dateInput.  It works fine but since I have a liveCallback now the regular callback doesn’t work.

Since you are refering to liveCallback, it looks as if you are using SeasideAsync.
Also, the code you are wondering about is using the canvas api.
However, live callbacks are not implemented (yet) for the canvas api.
Are you implementing it ?
Did you copy/paste some code into your component ?

I’m trying to understand the following code:

canvas hiddenInput

                        callback:

                                    [value := Date

                                                newDay: (day min: (Date daysInMonth: month forYear: year))

                                                monthNumber: month

                                                year: year.

                                    callbackBlock value: value];

                        close.

            canvas forgetCurrentBrush.

It all makes sense except the part of what triggers the callback in the first place.  Can someone point me to how this hiddenInput callback is triggered?  I’d like to modify my liveCallbackYear: to call this code and the regular callback code and then my liveCallback block.

Regular callbacks are triggered by the submission of the form.
i.e. click a submit button, hit the return key, execution of a submit() javascript.
Therefore you need a form if you want regular callbacks triggered.

The dateInput composite is made up of four html elements
a select for the month, an input for the day, an input for the year and
the hidden input, each with a callback. The first three callbacks
are for collecting the input values. The fourth callback assembles
the input values into an instance of Date and passes it to
the component callback.

Ultimately I’m trying to have a date with a field next to it that shows age.  If you change the age it changes the date, and if you change the date it changes the age.  I have the age updating the date just fine.  Now I need the date changes updating the age.

HTH
Michel.



_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: dateInput Question

Ron Teitelbaum
Hi Michel,

________________________________________
From: Michel Bany [mailto:[hidden email]]
Sent: Friday, November 03, 2006 3:16 AM

> Hi Ron,
> I was wondering if you could help me understand something.
> You do not provide enough background information.
> Are you using Squeak or VW ?
> Are you using SeasideAsynx of Scriptaculous ?

I'm using Squeak and SeasideAsync and Scriptaculous


> Also, the code you are wondering about is using the canvas api.
> However, live callbacks are not implemented (yet) for the canvas api.
> Are you implementing it ?

I'm adding liveCallbackYear to dateInput.

> Did you copy/paste some code into your component ?

Yes I added the following:

liveCallbackYear: liveBlock
        | uri id |
        liveBlock fixTemps.
        id _ self ensureId.
        uri _ canvas urlForLiveAction:
                [:event :h | liveBlock
                        value: event value
                        value: h].
        self session
                addLoadScript:
                        'liveSearch('
                                , (id asString, '-year') printString
                                , ','
                                , (canvas encode: uri asString) printString
                                , ')'.


>> I’m trying to understand the following code:
>> canvas hiddenInput
>>                        callback:
>>                                    [value := Date
>>                                                newDay: (day min: (Date
>> daysInMonth: month forYear: year))
>>                                                monthNumber: month
>>                                                year: year.
>>                                    callbackBlock value: value];
>>                        close.
>>            canvas forgetCurrentBrush.

> The dateInput composite is made up of four html elements
> a select for the month, an input for the day, an input for the year and
> the hidden input, each with a callback. The first three callbacks
> are for collecting the input values. The fourth callback assembles
> the input values into an instance of Date and passes it to
> the component callback.

I can see that it creates the date but what triggers the hiddenInput
callback?  It appears to work without submitting the form.

Thanks for your help!

Ron

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: dateInput Question

Michel Bany
Hi Ron,

Now, I see what you are trying to do, you are trying to implement
a SeasideAsync missing piece.

Actually, I have had a for a long time, the project of finishing  
SeasideAsync,
adding live callbacks to radio buttons, date and time input and maybe
a few other smaller things. If found it not trivial and I gave up.
I will look if I can restart this project and let you know.

Cheers,
Michel.




On 03 Nov 2006, at 15:44 , Ron Teitelbaum wrote:

> Hi Michel,
>
> ________________________________________
> From: Michel Bany [mailto:[hidden email]]
> Sent: Friday, November 03, 2006 3:16 AM
>
>> Hi Ron,
>> I was wondering if you could help me understand something.
>> You do not provide enough background information.
>> Are you using Squeak or VW ?
>> Are you using SeasideAsynx of Scriptaculous ?
>
> I'm using Squeak and SeasideAsync and Scriptaculous
>
>
>> Also, the code you are wondering about is using the canvas api.
>> However, live callbacks are not implemented (yet) for the canvas api.
>> Are you implementing it ?
>
> I'm adding liveCallbackYear to dateInput.
>
>> Did you copy/paste some code into your component ?
>
> Yes I added the following:
>
> liveCallbackYear: liveBlock
> | uri id |
> liveBlock fixTemps.
> id _ self ensureId.
> uri _ canvas urlForLiveAction:
> [:event :h | liveBlock
> value: event value
> value: h].
> self session
> addLoadScript:
> 'liveSearch('
> , (id asString, '-year') printString
> , ','
> , (canvas encode: uri asString) printString
> , ')'.
>
>
>>> I’m trying to understand the following code:
>>> canvas hiddenInput
>>>                         callback:
>>>                                     [value := Date
>>>                                                 newDay: (day min:  
>>> (Date
>>> daysInMonth: month forYear: year))
>>>                                                 monthNumber: month
>>>                                                 year: year.
>>>                                     callbackBlock value: value];
>>>                         close.
>>>             canvas forgetCurrentBrush.
>
>> The dateInput composite is made up of four html elements
>> a select for the month, an input for the day, an input for the  
>> year and
>> the hidden input, each with a callback. The first three callbacks
>> are for collecting the input values. The fourth callback assembles
>> the input values into an instance of Date and passes it to
>> the component callback.
>
> I can see that it creates the date but what triggers the hiddenInput
> callback?  It appears to work without submitting the form.
>
> Thanks for your help!
>
> Ron
>

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: dateInput Question

Rick Flower
Michel Bany wrote:

> Hi Ron,
>
> Now, I see what you are trying to do, you are trying to implement
> a SeasideAsync missing piece.
>
> Actually, I have had a for a long time, the project of finishing
> SeasideAsync,
> adding live callbacks to radio buttons, date and time input and maybe
> a few other smaller things. If found it not trivial and I gave up.
> I will look if I can restart this project and let you know.
>
Michel,

Not to be a pain or anything, but is there a list somewhere indicating
what the missing
stuff is so that nobody (for now) stumbles over it in the future -- or
at least focuses on
only using liveCallbacks for those areas where they're implemented?  
I've currently got
some new code I wrote the other day for doing liveCallbacks on Select
lists and of course
it works great, but I'd be interested in hearing what I should shy away
from.. Thanks!

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: dateInput Question

Ron Teitelbaum
In reply to this post by Michel Bany
I see I was wrong the callback is triggered by the request of the form post
on the callback stream.  So it looks like the hidden field is just a place
to put the callback on, but is not actually used in the form itself.  Is
that right?

Ron



> -----Original Message-----
> From: Michel Bany
> Sent: Friday, November 03, 2006 10:05 AM
>
> Hi Ron,
>
> Now, I see what you are trying to do, you are trying to implement
> a SeasideAsync missing piece.
>
> Actually, I have had a for a long time, the project of finishing
> SeasideAsync,
> adding live callbacks to radio buttons, date and time input and maybe
> a few other smaller things. If found it not trivial and I gave up.
> I will look if I can restart this project and let you know.
>
> Cheers,
> Michel.
>
>
>
>
> On 03 Nov 2006, at 15:44 , Ron Teitelbaum wrote:
>
> > Hi Michel,
> >
> > ________________________________________
> > From: Michel Bany [mailto:[hidden email]]
> > Sent: Friday, November 03, 2006 3:16 AM
> >
> >> Hi Ron,
> >> I was wondering if you could help me understand something.
> >> You do not provide enough background information.
> >> Are you using Squeak or VW ?
> >> Are you using SeasideAsynx of Scriptaculous ?
> >
> > I'm using Squeak and SeasideAsync and Scriptaculous
> >
> >
> >> Also, the code you are wondering about is using the canvas api.
> >> However, live callbacks are not implemented (yet) for the canvas api.
> >> Are you implementing it ?
> >
> > I'm adding liveCallbackYear to dateInput.
> >
> >> Did you copy/paste some code into your component ?
> >
> > Yes I added the following:
> >
> > liveCallbackYear: liveBlock
> > | uri id |
> > liveBlock fixTemps.
> > id _ self ensureId.
> > uri _ canvas urlForLiveAction:
> > [:event :h | liveBlock
> > value: event value
> > value: h].
> > self session
> > addLoadScript:
> > 'liveSearch('
> > , (id asString, '-year') printString
> > , ','
> > , (canvas encode: uri asString) printString
> > , ')'.
> >
> >
> >>> I'm trying to understand the following code:
> >>> canvas hiddenInput
> >>>                         callback:
> >>>                                     [value := Date
> >>>                                                 newDay: (day min:
> >>> (Date
> >>> daysInMonth: month forYear: year))
> >>>                                                 monthNumber: month
> >>>                                                 year: year.
> >>>                                     callbackBlock value: value];
> >>>                         close.
> >>>             canvas forgetCurrentBrush.
> >
> >> The dateInput composite is made up of four html elements
> >> a select for the month, an input for the day, an input for the
> >> year and
> >> the hidden input, each with a callback. The first three callbacks
> >> are for collecting the input values. The fourth callback assembles
> >> the input values into an instance of Date and passes it to
> >> the component callback.
> >
> > I can see that it creates the date but what triggers the hiddenInput
> > callback?  It appears to work without submitting the form.
> >
> > Thanks for your help!
> >
> > Ron
> >
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: dateInput Question

Michel Bany
In reply to this post by Rick Flower
Hi Rick,

> Not to be a pain or anything, but is there a list somewhere  
> indicating what the missing
> stuff is so that nobody (for now) stumbles over it in the future --  
> or at least focuses on
> only using liveCallbacks for those areas where they're  
> implemented?  I've currently got
> some new code I wrote the other day for doing liveCallbacks on  
> Select lists and of course
> it works great, but I'd be interested in hearing what I should shy  
> away from.. Thanks!

I just committed a new version of SeasideAsync that has reasonable  
support
for date/time input and for radio buttons.

As you can imagine, I will not be able to provide you with a list of  
what is missing.
There are so much things that are not implemented. However, if you  
give me a list
of the things you need, then I can tell you how much it is available.

Cheers,
Michel.


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: dateInput Question

Michel Bany
In reply to this post by Ron Teitelbaum
Ron,

I committed SeasideAsync-mb.49 to squeaksource.
It has support for date/time input and radio buttons.
It requires the most recent version of Seaside2.6b1 (-mb.117).

You may want to give it a try like this.

        html dateInput
                value: date;
                liveCallback:
                        [:value :renderer |
                        date := value.
                        etc.
                        ]

The live callback receives a Date instance from which you can get
the date for computing the age.

Make sure you pay attention to the comments I placed in the
SeasideAsync package regarding upwards compatibility.
SeasideAsync is now using its own renderer (one for canvas and
one for classic) and the javascripts are in a separate library.

In Seaside2.6b1-mb-117 date input supports a new configuration method
#options: that allows you to control the order and the presence/absence
of the three date elements (day month year), for instance

        html dateInput
                value: date;
                options: #(day month);
                etc.

Cheers,
Michel.


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: dateInput Question

Ron Teitelbaum
That is fantastic!  Thank you very much for doing it.  I'll look at it right
away!

Ron

> -----Original Message-----
> From: [hidden email] [mailto:seaside-
> [hidden email]] On Behalf Of Michel Bany
> Sent: Monday, November 06, 2006 10:43 AM
> To: The Squeak Enterprise Aubergines Server - general discussion.
> Subject: Re: [Seaside] dateInput Question
>
> Ron,
>
> I committed SeasideAsync-mb.49 to squeaksource.
> It has support for date/time input and radio buttons.
> It requires the most recent version of Seaside2.6b1 (-mb.117).
>
> You may want to give it a try like this.
>
> html dateInput
> value: date;
> liveCallback:
> [:value :renderer |
> date := value.
> etc.
> ]
>
> The live callback receives a Date instance from which you can get
> the date for computing the age.
>
> Make sure you pay attention to the comments I placed in the
> SeasideAsync package regarding upwards compatibility.
> SeasideAsync is now using its own renderer (one for canvas and
> one for classic) and the javascripts are in a separate library.
>
> In Seaside2.6b1-mb-117 date input supports a new configuration method
> #options: that allows you to control the order and the presence/absence
> of the three date elements (day month year), for instance
>
> html dateInput
> value: date;
> options: #(day month);
> etc.
>
> Cheers,
> Michel.
>
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: dateInput Question

Ron Teitelbaum
It works beautifully, thank you very much!  It was exactly what I needed.

Ron

> -----Original Message-----
> From: [hidden email] [mailto:seaside-
> [hidden email]] On Behalf Of Ron Teitelbaum
> Sent: Monday, November 06, 2006 1:05 PM
> To: 'The Squeak Enterprise Aubergines Server - general discussion.'
> Subject: RE: [Seaside] dateInput Question
>
> That is fantastic!  Thank you very much for doing it.  I'll look at it
> right
> away!
>
> Ron
>
> > -----Original Message-----
> > From: [hidden email] [mailto:seaside-
> > [hidden email]] On Behalf Of Michel Bany
> > Sent: Monday, November 06, 2006 10:43 AM
> > To: The Squeak Enterprise Aubergines Server - general discussion.
> > Subject: Re: [Seaside] dateInput Question
> >
> > Ron,
> >
> > I committed SeasideAsync-mb.49 to squeaksource.
> > It has support for date/time input and radio buttons.
> > It requires the most recent version of Seaside2.6b1 (-mb.117).
> >
> > You may want to give it a try like this.
> >
> > html dateInput
> > value: date;
> > liveCallback:
> > [:value :renderer |
> > date := value.
> > etc.
> > ]
> >
> > The live callback receives a Date instance from which you can get
> > the date for computing the age.
> >
> > Make sure you pay attention to the comments I placed in the
> > SeasideAsync package regarding upwards compatibility.
> > SeasideAsync is now using its own renderer (one for canvas and
> > one for classic) and the javascripts are in a separate library.
> >
> > In Seaside2.6b1-mb-117 date input supports a new configuration method
> > #options: that allows you to control the order and the presence/absence
> > of the three date elements (day month year), for instance
> >
> > html dateInput
> > value: date;
> > options: #(day month);
> > etc.
> >
> > Cheers,
> > Michel.
> >
> >
> > _______________________________________________
> > Seaside mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside