[pmwiki-users] wikiform - making a field required if a previous option is selected

john.rankin at affinity.co.nz john.rankin at affinity.co.nz
Sun Nov 9 02:03:41 CST 2008


> hello
>
> i've been asked if it is possible to direct a user to fill in a second
> field depending on their answer to a first field.
>
> for example
>
> question one -
>
> :Callout Required:reqcallout Is callout required overnight (*Yes;No)
>
> is then followed by
>
> question two -
>
> :Callout Details:callout Who is oncall for this server (text=3*50)
>
> i could use the required element as in
>
> :Callout Details:callout Who is oncall for this server ("Required"=50)
>
> but this is not dependant on the user selecting 'no' on the first
> question.
>
> i could just lose question 1 and make question 2 more vague like 'if
> callout is required pls state..' but was hoping
>  there might be another way possible?
>
> thanks
>
> david r.

There is no immediate or obvious way to do this with the current
wikiform template syntax. Dependencies between field values are
currently not supported. Conceptually, the code that processes the
submitted form needs to test the value of 'callout' and if blank, test
the value of 'reqcallout' and if = 'yes' insert the value 'Required'.
Then it would be possible to list pages where the required value has
not been entered.

Solving this requires:

- a syntax to specify the field interdependency rule

- code to evaluate the rule and if necessary insert the specified text

The question that comes to mind is, "What else do people want to do
with form processing logic?" Adding this as a special case without
thinking about the big picture introduces a "release early, get stuck"
risk.

To answer the original question, "Is it possible to..."

    No, but I'll think about it.

JR







More information about the pmwiki-users mailing list