Stupid anchor question

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

Stupid anchor question

Leandro Pérez
Hello,
I want to do this: when clicking on an anchor, something else must be displayed on a new page..just like simple html

MyComponent>>renderContentOn: html
html anchor
    callback:[self renderSomethingElseOn:html];
    with:'go to somewhere else'

MyComponent>>renderSomethingElseOn:html
html div with:'this is something else'

and I always get this exception
Message not understood: #openTag:attributes:closed:

I guess the whole idea might be wrong... is it?

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Stupid anchor question

Philippe Marschall
2007/8/14, Leandro Pérez <[hidden email]>:

>
> Hello,
> I want to do this: when clicking on an anchor, something else must be
> displayed on a new page..just like simple html
>
> MyComponent>>renderContentOn: html
> html anchor
>     callback:[self renderSomethingElseOn:html];
>     with:'go to somewhere else'
>
> MyComponent>>renderSomethingElseOn:html
> html div with:'this is something else'
>
> and I always get this exception
> Message not understood: #openTag:attributes:closed:
>
> I guess the whole idea might be wrong... is it?
Yes, you mix the callback and the rendering phase. In the callback
phase your "actions" are executed, you can do no rendering there. Your
html argument will be invalid.

The easiest way to make your example work is to create a new Component
for 'this is something else' called SomethingElseComponent (or
something else) the action triggered by the link would then do a
#call: on this new component. This temporarily replaces MyComponent
with SomethingElseComponent until you send #answer: in
SomethingElseComponent.

MyComponent>>renderContentOn: html
    html anchor
        callback:[ self renderSomethingElse ];
        with:'go to somewhere else'

MyComponent>>renderSomethingElse
    self call: SomethingElseComponent new

SomethingElseComponent >> #renderContentOn: html
    html div with:'this is something else'

Cheers
Philippe

> Thanks!
> --
> View this message in context: http://www.nabble.com/Stupid-anchor-question-tf4267248.html#a12144350
> Sent from the Squeak - Seaside mailing list archive at Nabble.com.
>
> _______________________________________________
> 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: Stupid anchor question

John Thornborrow
For small items such as this (or perhaps an error on form validation or
similar, or a toggle) I prefer to use a boolean instvar such as:

#initialize
   boolean _ false.
   ^super initialize

#renderContentOn: html
   html anchor
     callback: [boolean _ boolean not];
     with: [html text: 'toggle'].
   boolean ifTrue: [html div with: [html text: 'this is some text']]

Regards,
John.

www.pinesoft.co.uk

Philippe Marschall wrote:

> 2007/8/14, Leandro Pérez <[hidden email]>:
>> Hello,
>> I want to do this: when clicking on an anchor, something else must be
>> displayed on a new page..just like simple html
>>
>> MyComponent>>renderContentOn: html
>> html anchor
>>     callback:[self renderSomethingElseOn:html];
>>     with:'go to somewhere else'
>>
>> MyComponent>>renderSomethingElseOn:html
>> html div with:'this is something else'
>>
>> and I always get this exception
>> Message not understood: #openTag:attributes:closed:
>>
>> I guess the whole idea might be wrong... is it?
>
> Yes, you mix the callback and the rendering phase. In the callback
> phase your "actions" are executed, you can do no rendering there. Your
> html argument will be invalid.
>
> The easiest way to make your example work is to create a new Component
> for 'this is something else' called SomethingElseComponent (or
> something else) the action triggered by the link would then do a
> #call: on this new component. This temporarily replaces MyComponent
> with SomethingElseComponent until you send #answer: in
> SomethingElseComponent.
>
> MyComponent>>renderContentOn: html
>     html anchor
>         callback:[ self renderSomethingElse ];
>         with:'go to somewhere else'
>
> MyComponent>>renderSomethingElse
>     self call: SomethingElseComponent new
>
> SomethingElseComponent >> #renderContentOn: html
>     html div with:'this is something else'
>
> Cheers
> Philippe
>
>> Thanks!
>> --
>> View this message in context: http://www.nabble.com/Stupid-anchor-question-tf4267248.html#a12144350
>> Sent from the Squeak - Seaside mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> 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


Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA



This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com

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

Re: Stupid anchor question

Leandro Pérez
In reply to this post by Philippe Marschall

Philippe Marschall wrote
Yes, you mix the callback and the rendering phase. In the callback
phase your "actions" are executed, you can do no rendering there. Your
html argument will be invalid.

The easiest way to make your example work is to create a new Component
for 'this is something else' called SomethingElseComponent (or
something else) the action triggered by the link would then do a
#call: on this new component. This temporarily replaces MyComponent
with SomethingElseComponent until you send #answer: in
SomethingElseComponent.
...
Cheers
Philippe
Thanks Philippe, I ended up doing what you suggested.
regards