[英]Why is the callback not being executed?
I'm writing a basic web application (begin with seaside) but the callback never runs...any ideas? 我正在编写一个基本的Web应用程序(从海边开始),但回调从未运行......任何想法?
renderContentOn: html
| group |
html form: [
html text: 'Gender: '.
group := html radioGroup.
group radioButton
selected: self contact isMale;
callback: [ self contact beMale ].
html text: 'Male'.
group radioButton
selected: self contact isFemale;
callback: [ self contact beFemale ].
html text: 'Female'.
html break.
html anchor
callback: [ mmpiItems setAnswer: (self option) ];
with: 'Next'.
]
An anchor inside the form does not submit the form, only a submitbutton does. 表单内的锚点不提交表单,只提交提交按钮。 This is not defined by Seaside but by HTML. 这不是由Seaside定义的,而是由HTML定义的。
You can find more information in the seaside book on writing forms with Seaside: http://book.seaside.st/book/fundamentals/forms 您可以在海边书中找到有关海边书写表格的更多信息: http : //book.seaside.st/book/fundamentals/forms
You must use submitButton
instead of an anchor
or any other button
. 您必须使用submitButton
而不是anchor
或任何其他button
。
Your code would look like this: 您的代码如下所示:
renderContentOn: html
| group |
html form: [
html text: 'Gender: '.
group := html radioGroup.
group radioButton
selected: self contact isMale;
callback: [ self contact beMale ].
html text: 'Male'.
group radioButton
selected: self contact isFemale;
callback: [ self contact beFemale ].
html text: 'Female'.
html break.
"Use a submitButton instead of a regular anchor/button"
html submitButton
callback: [ mmpiItems setAnswer: (self option) ];
with: 'Next'.
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.