Re-rendering page when Radio button is hit

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

Re-rendering page when Radio button is hit

squeakman
Hello,

I have a page with a form that contains some radio buttons.  I do NOT
have a Submit button on the form.

When a radio button is hit, I am using onClick: to execute some block of
code. In that block of code I would like to force the entire page to be
re-displayed. Is there a way to do this?

Thank you for any help you can provide,

Frank

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

Re: Re-rendering page when Radio button is hit

Lukas Renggli
You respond with JavaScript code that performs a redirect. The
following snippet creates the necessary code:

   JSScript new refresh

Lukas

On 22 September 2011 20:45, squeakman <[hidden email]> wrote:

> Hello,
>
> I have a page with a form that contains some radio buttons.  I do NOT have a
> Submit button on the form.
>
> When a radio button is hit, I am using onClick: to execute some block of
> code. In that block of code I would like to force the entire page to be
> re-displayed. Is there a way to do this?
>
> Thank you for any help you can provide,
>
> Frank
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



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

Re: Re-rendering page when Radio button is hit

squeakman
When I execute JSScript new refresh

I get DNU on actionUrl

because renderContext in JSScript>refresh is nil

To try an fix this I did

     (JSScript context: r) refresh

where r is the renderer passed to me in the onClick block. This seemed
to produce reasonable looking javascript code:

        a Javascript.JSScript
(window.location="/spTester?_s=yA1JxETs--GlzLo1&_k=1mMP7DBLSskgMBXr")

but it did not cause the page to refresh (I have a breakpoint in
renderContentOn: that did not get triggered).

Any ideas on what could be wrong?

Thanks,
Frank

On 22/09/2011 3:00 PM, Lukas Renggli wrote:

> You respond with JavaScript code that performs a redirect. The
> following snippet creates the necessary code:
>
>     JSScript new refresh
>
> Lukas
>
> On 22 September 2011 20:45, squeakman<[hidden email]>  wrote:
>> Hello,
>>
>> I have a page with a form that contains some radio buttons.  I do NOT have a
>> Submit button on the form.
>>
>> When a radio button is hit, I am using onClick: to execute some block of
>> code. In that block of code I would like to force the entire page to be
>> re-displayed. Is there a way to do this?
>>
>> Thank you for any help you can provide,
>>
>> Frank
>>
>> _______________________________________________
>> 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: Re-rendering page when Radio button is hit

Lukas Renggli
Sorry, JSScript should be not instantiated like I wrote, you need to
create it from the appropriate factory object.

For example you can refresh from the client side:

    html div
       onClick: html javascript refresh;
       with: 'Refresh from client'.

Or as part of an AJAX action from the server side:

   html div
      onClick: (html jQuery ajax
           script: [ :script | script refresh ])
      with: 'Refresh from server'.

There are other possible use-cases.

Lukas

On 22 September 2011 21:58, squeakman <[hidden email]> wrote:

> When I execute JSScript new refresh
>
> I get DNU on actionUrl
>
> because renderContext in JSScript>refresh is nil
>
> To try an fix this I did
>
>    (JSScript context: r) refresh
>
> where r is the renderer passed to me in the onClick block. This seemed to
> produce reasonable looking javascript code:
>
>        a Javascript.JSScript
> (window.location="/spTester?_s=yA1JxETs--GlzLo1&_k=1mMP7DBLSskgMBXr")
>
> but it did not cause the page to refresh (I have a breakpoint in
> renderContentOn: that did not get triggered).
>
> Any ideas on what could be wrong?
>
> Thanks,
> Frank
>
> On 22/09/2011 3:00 PM, Lukas Renggli wrote:
>>
>> You respond with JavaScript code that performs a redirect. The
>> following snippet creates the necessary code:
>>
>>    JSScript new refresh
>>
>> Lukas
>>
>> On 22 September 2011 20:45, squeakman<[hidden email]>  wrote:
>>>
>>> Hello,
>>>
>>> I have a page with a form that contains some radio buttons.  I do NOT
>>> have a
>>> Submit button on the form.
>>>
>>> When a radio button is hit, I am using onClick: to execute some block of
>>> code. In that block of code I would like to force the entire page to be
>>> re-displayed. Is there a way to do this?
>>>
>>> Thank you for any help you can provide,
>>>
>>> Frank
>>>
>>> _______________________________________________
>>> 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
>



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

Re: Re-rendering page when Radio button is hit

squeakman
In reply to this post by squeakman
I got it working.

The fix was

  r script: ((Javascript.JSScript context: html)  refresh)

instead of:
        r (Javascript.JSScript context: html)  refresh


Thanks so much for your help,

Frank


On 22/09/2011 3:58 PM, squeakman wrote:

> When I execute JSScript new refresh
>
> I get DNU on actionUrl
>
> because renderContext in JSScript>refresh is nil
>
> To try an fix this I did
>
> (JSScript context: r) refresh
>
> where r is the renderer passed to me in the onClick block. This seemed
> to produce reasonable looking javascript code:
>
> a Javascript.JSScript
> (window.location="/spTester?_s=yA1JxETs--GlzLo1&_k=1mMP7DBLSskgMBXr")
>
> but it did not cause the page to refresh (I have a breakpoint in
> renderContentOn: that did not get triggered).
>
> Any ideas on what could be wrong?
>
> Thanks,
> Frank
>
> On 22/09/2011 3:00 PM, Lukas Renggli wrote:
>> You respond with JavaScript code that performs a redirect. The
>> following snippet creates the necessary code:
>>
>> JSScript new refresh
>>
>> Lukas
>>
>> On 22 September 2011 20:45, squeakman<[hidden email]> wrote:
>>> Hello,
>>>
>>> I have a page with a form that contains some radio buttons. I do NOT
>>> have a
>>> Submit button on the form.
>>>
>>> When a radio button is hit, I am using onClick: to execute some block of
>>> code. In that block of code I would like to force the entire page to be
>>> re-displayed. Is there a way to do this?
>>>
>>> Thank you for any help you can provide,
>>>
>>> Frank
>>>
>>> _______________________________________________
>>> 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