具有变形的动态形状

2024-09-27 07:29:28 发布

您现在位置:Python中文网/ 问答频道 /正文

使用deform和whululd希望根据用户的选择更改pageShema类。 例如,如果他从selectwidget中选择了选项1,则向他显示一组字段,如果是其他选择,则显示另一组字段。 怎么做?在


Tags: 用户选项deform另一组selectwidgetpageshemawhululd
1条回答
网友
1楼 · 发布于 2024-09-27 07:29:28

您可以使用jquery和带有“name”属性的select。 另外,您可以使用jquery“parent()”函数来获取您感兴趣的显示/隐藏输入的容器。在

例如,在模式中执行以下操作:

# This is the "<select>"
choices = (('yes','Yes'),
           ('no', 'No'))
bar = colander.SchemaNode(colander.String(),
                          widget=deform.widget.SelectWidget(values=choices))

# This is the input that should appear only when the "yes" value is selected
foo = colander.SchemaNode(colander.String())

然后,在模板中添加以下内容:

^{pr2}$

相关问题 更多 >

    热门问题