Hi all,
here's my code:
[[!FormIt?
&hooks=`myHook,redirect`
&redirectTo=`35`
&store=`1`
&validate=`
field1:required,
field2:required,
]]
<form action="[[~[[*id]]]]" method="post">
<label for="field1">
Field1:
</label>
<select name="field1">
<option value="option1">option1</option>
</select>
<label for="field2">
Field2:
</label>
<select name="field2">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
<input type="submit" value="Go!" /><br />
</form>
The hook snippet
myHook aspects the properties
field1 and
field2 and uses them like this:
$hook = $scriptProperties['hook'];
$field1 = $hook->getValue('field1');
$field2 = $hook->getValue('field2');
//do something
and works perfectly.
Originally the
field1 was a select field with several options, but now it's reduced to just one. So I tried to omit this field and use its now fix value directly - without changing the
myHook snippet.
I tried this code:
[[!FormIt?
&field1=`option1` <<<<
&hooks=`myHook,redirect`
&redirectTo=`35`
&store=`1`
&validate=`
field2:required,
]]
<form action="[[~[[*id]]]]" method="post">
<p>Field1 has value [[+fi.field1]]</p>
<label for="field2">
Field2:
</label>
<select name="field2">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
<input type="submit" value="Go!" /><br />
</form>
But this does't work; obviously
myHook does not receive the value of
field1.
What am I doing wrong?