为什么回调没有被执行?

时间:2016-12-13 01:55:48

标签: smalltalk pharo seaside

我正在编写一个基本的网络应用程序(从海边开始),但回调永远不会运行......任何想法?

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'.
 ]

2 个答案:

答案 0 :(得分:2)

表单内的锚点不提交表单,只提交提交按钮。这不是由Seaside定义的,而是由HTML定义的。

您可以在海边书中找到更多有关使用Seaside撰写表格的信息:http://book.seaside.st/book/fundamentals/forms

答案 1 :(得分:1)

您必须使用submitButton代替anchor或任何其他button

您的代码如下所示:

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'.
   ]