Select 为什么不执行回调?-闲话
我正在制作一个web应用程序,将YouTube视频添加到播放列表中。包含用户当前播放列表的视频缩略图旁边会显示选择,当用户单击提交按钮时,当前视频应添加到所选播放列表中。但是,我遇到了一个回调似乎没有执行的问题。如果答案是琐碎的,我很抱歉,因为我看不出问题出在哪里:Select 为什么不执行回调?-闲话,select,callback,smalltalk,seaside,Select,Callback,Smalltalk,Seaside,我正在制作一个web应用程序,将YouTube视频添加到播放列表中。包含用户当前播放列表的视频缩略图旁边会显示选择,当用户单击提交按钮时,当前视频应添加到所选播放列表中。但是,我遇到了一个回调似乎没有执行的问题。如果答案是琐碎的,我很抱歉,因为我看不出问题出在哪里: html form with: [html select with: self session getPlaylists keysDo:
html form with:
[html select with:
self session getPlaylists keysDo:
[:k | html option value: k; with: [html text:k]]];
callback: [:v | self session addVideo: ((searchRes at: 'items')
at: (i*2+x)) toPlaylist: v. Transcript show: 'call'].
html break.
html submitButton class:'tiny button';value: 'Add to Playlist']
对不起,代码太乱了。基本上,回调没有执行(我知道这一点,因为表单提交时“call”没有打印到成绩单中)。非常感谢您的澄清。因为带:的
块位于错误的位置。在Seaside中,使用html画布时,with:
是级联中的最后一条消息
更详细地说:
WATagBrush>>with: anObject
"Render anObject into the receiver. Make sure that you call #with: last in the cascade, as this method will serialize the tag onto the output document."
self openTag.
super with: [
self before.
canvas render: anObject.
self after ].
self isClosed
ifFalse: [ self closeTag ]
其中super是对WABrush>>的调用,使用:
WABrush>>with:
with: aBlock
canvas nest: aBlock.
closed := true
因此,回调永远不会写入服务器发送到浏览器的响应文档中。您使用的是seaside吗?你能用一个简单的表格和选择重现这个问题吗?为什么不使用waselectag>>列表:
传递对象,并使用waselectag>>标签
为每个元素指定标签块(更干净)。