Newbie Q: Help with Canvas API Radiobuttons and Ajax

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

Newbie Q: Help with Canvas API Radiobuttons and Ajax

Shawn MacIntyre

Hello,

I have been learning Seaside and I am very interested in the new rendering API and the integrated Ajax support. However, I have run into a point where I am stumped.  I am trying to build a simple yes/no poll as a learning experience. Everything displays fine and when don't make a selection I get the result I expect. However I get an error when I make a selection. I would appreciate any pointers on where I have gone wrong. I am running Squeak 3.8 and the latest release of Seaside 2.6.

This is the offending code:
!URVote methodsFor: 'as yet unclassified' stamp: 'sdm 3/11/2006 23:40'!
renderContentOn: html
html div class: 'vote'; with: [
html heading: 'Today''s Vote' level: 2.
html paragraph class: 'question'; with: 'Are you happy?'.

html div id: 'vote'.
html radioGroup: [:group |
html radioButton
group: group;
id: 'yesVote';
with: 'Yes';
callback: [ self yesVote ].
html break.
html radioButton
group: group;
id: 'noVote';
with: 'No';
callback: [ self noVote ].
html break].

html button value: 'Vote';
onClick: (html ajax
id: 'vote';
triggerCallbackFor: 'yesVote';
triggerCallbackFor: 'noVote';
on: #renderVotesOn: of: self)]
! !

This is the trace back displayed in the browser:

Error: key not found

  • Dictionary(Object)>>error:
  • self
  • a Dictionary('1'->a WADispatchCallback '2'->a WAValueCallback '3'->a WAValueCallback '4'->a WAAction...etc...
  • temps
  • aString
  • 'key not found'
  • inst vars
  • tally
  • 9
  • array
  • #('3'->a WAValueCallback '8'->a WAActionCallback '1'->a WADispatchCallback '6'->a WAActionCallback n...etc...
  • Dictionary>>errorKeyNotFound
  • self
  • a Dictionary('1'->a WADispatchCallback '2'->a WAValueCallback '3'->a WAValueCallback '4'->a WAAction...etc...
  • temps
  • inst vars
  • tally
  • 9
  • array
  • #('3'->a WAValueCallback '8'->a WAActionCallback '1'->a WADispatchCallback '6'->a WAActionCallback n...etc...
  • [] in Dictionary>>at: {[self errorKeyNotFound]}
  • self
  • a Dictionary('1'->a WADispatchCallback '2'->a WAValueCallback '3'->a WAValueCallback '4'->a WAAction...etc...
  • temps
  • key
  • 'on'
  • inst vars
  • tally
  • 9
  • array
  • #('3'->a WAValueCallback '8'->a WAActionCallback '1'->a WADispatchCallback '6'->a WAActionCallback n...etc...
  • Dictionary>>at:ifAbsent:
  • self
  • a Dictionary('1'->a WADispatchCallback '2'->a WAValueCallback '3'->a WAValueCallback '4'->a WAAction...etc...
  • temps
  • key
  • 'on'
  • aBlock
  • [] in Dictionary>>at: {[self errorKeyNotFound]}
  • assoc
  • nil
  • inst vars
  • tally
  • 9
  • array
  • #('3'->a WAValueCallback '8'->a WAActionCallback '1'->a WADispatchCallback '6'->a WAActionCallback n...etc...
  • Dictionary>>at:
  • self
  • a Dictionary('1'->a WADispatchCallback '2'->a WAValueCallback '3'->a WAValueCallback '4'->a WAAction...etc...
  • temps
  • key
  • 'on'
  • inst vars
  • tally
  • 9
  • array
  • #('3'->a WAValueCallback '8'->a WAActionCallback '1'->a WADispatchCallback '6'->a WAActionCallback n...etc...

Thank you for your help,
Shawn




--
Shawn MacIntyre
Edmonton, Alberta, Canada





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

URVote.st (2K) Download Attachment
URComponent.st (455 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Newbie Q: Help with Canvas API Radiobuttons and Ajax

Lukas Renggli
>  with: 'Yes';
>  callback: [ self yesVote ].
> [...]
>  with: 'No';
>  callback: [ self noVote ].

#with: must be always the last message in the cascade, because it
triggers to emit the HTML tag to the stream. In you version the
callback gets ignored after all, it should work if you swap #with: and
#callback:

But yes, I should write some tests for all HTML form controls, I not
quite sure if they all work properly together with the script.aculo.us
framework ;-)

Cheers,
Lukas

--
Lukas Renggli
http://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: Newbie Q: Help with Canvas API Radiobuttons and Ajax

Shawn MacIntyre

On Mar 12, 2006, at 2:01, Lukas Renggli wrote:

>>  with: 'Yes';
>>  callback: [ self yesVote ].
>> [...]
>>  with: 'No';
>>  callback: [ self noVote ].
>
> #with: must be always the last message in the cascade, because it
> triggers to emit the HTML tag to the stream. In you version the
> callback gets ignored after all, it should work if you swap #with: and
> #callback:
>

Thank you very much for your help Lukas!

It works perfectly now -- I know I was just miss understand how  
things worked.

Thanks,
Shawn
--
Shawn MacIntyre
Edmonton, Alberta, Canada


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