Forum OpenACS Development: Re: XoWiki

Collapse
48: Re: XoWiki (response to 1)
Posted by Nima Mazloumi on
Has someone a working example for a single select and multiple choice question using xowiki::Form?
Collapse
49: Re: XoWiki (response to 48)
Posted by Nima Mazloumi on
Form:
@mc@

Constraints:
mc:select,required,options=?

Not sure how to enter the options.

Collapse
50: Re: XoWiki (response to 48)
Posted by Nima Mazloumi on
If I use html form direclty the options are missing:
<form>
<select name="standards">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</form>
Collapse
51: Re: XoWiki (response to 48)
Posted by Nima Mazloumi on
Another problem I have. I use xowiki::Form with this:

Template:
@myvar@

Form:
&lt;input name="myvar" type="text" /&gt;

When I fill out the form leaving myvar empty I get:

**** unknown variable 'myvar' **** (::6545133 ::xowiki::FormPage->get_value)

I tried the constraints:

@fields:optional or myvar:optional but it doesn't help.

Any idea?

Collapse
52: Re: XoWiki (response to 51)
Posted by Gustaf Neumann on

q1: every form-field-spec in the form constraints is a Tcl list element. therefore use

Form:
@mc@

Constraints:
{mc:select,required,options={yes 1} {no 0}}

q2: There is a but in some tdom versions that convert the given text to

<form>
<select name="standards">
<option value="1" selected="selected"></option>1
<option value="2"></option>2
<option value="3"></option>3
</select>
</form>
which is not displayed. an upgrade of tdom from cvs should help.

q3: unknown variable 'myvar'
The message says, that there are form entries in your database that have this variable not defined. This is most likely due to the fact that you have changed to form after some instances got some values. Most likely, you can deleted some earlier form instances to get rid of the warning message.

oops, i missed q0: examples:
Here are single and multiple choice questions: http://alice.wu-wien.ac.at:8000/xowiki-demo/klausur
some more examples: http://alice.wu-wien.ac.at:8000/s5-xowiki-060/slides

i have added the export of the demo examples above to http://media.wu-wien.ac.at/download/xowiki-forms-demo.export