我想通过 modx 插件 formz 将 gumbyframework 用于我的表单。为此,我必须在下面创建自己的块。我“认为”我拥有所有需要的元素,并且使用了块,所以我看不出为什么它不能正常工作。但是会显示主要错误消息。
我也收到此错误消息,但我不知道它是否与formz有关。
[2014-03-03 19:32:47] (ERROR @ /example/index.php) `[[+id]]` is not a valid integer and may not be passed to makeUrl()
表单Tpl
[[!FormIt?
&hooks=`[[+action]][[+hooks:notempty=`,[[+hooks]]`]]`
&tpl=`emailTpl`
&excludeFields=`submit[[+id]]`
&submitVar=`submit[[+id]]`
&formid=`[[+id]]` [[- "Form ID"]]
&store=`1`
&storeTime=`900`
&successMessage=`<p>[[+success_message]]</p>`
&emailTo=`[[+email:default=``]]`
[[+properties]]
[[+validation:notempty=`&validate=`[[+validation]]``]]
[[+validationText:notempty=`[[+validationText]]`]]
]]
[[!+fi.successMessage]]
[[!+fi.validation_error_message]]
<form id="form[[+id]]" class="form [[+identifier]]" action="" method="post">
<fieldset>
[[+fields]]
</fieldset>
<div class="actions row">
<div class="form__field__submit columns ten push_two">
<input type="hidden" name="submit[[+id]]" value=" [[+action_button:default=`Submit`]]"/>
<a class="submit" type="submit" name="submit[[+id]]" class="btn primary" href="javascript:document.getElementById('form[[+id]]').submit();">[[+action_button:default=`Submit`]]</a>
</div>
</div>
字段Tpl
[[!field? &type=`[[+type]]` &name=`[[+id]]` &label=`[[+label]]` &req=`[[+required]]` [[+type:eq=`checkbox`:then=`&array=`1``]] &options=`[[+values]]` &default_value=`[[+default]]` &tpl=`formz__field--gumby` &outer_tpl=`formz__wrap--gumby`]]
字段换行
<!-- default -->
<div class="[[+outer_class]] row" id="[[+name]]_wrap">
<div class="form__field__label columns two">
<label for="[[+name]]" title="[[+name:replace=`_== `:ucwords]]">[[+label:default=`[[+name:replace=`_== `:ucwords]]`]][[+req:notempty=` *`]]</label>
</div>
<div class="form__field__input columns ten field">
[[+inner_html]]
[[+note:notempty=`<span class="[[+note_class:default=`note`]]"><em>[[+note]]</em></span>`]]
[[+error:notempty=`<span class="[[+error_class]]">[[+error]]</span>`]]
</div>
</div>
<!-- default -->
<!-- select -->
<div class="[[+outer_class]] row form__row--half_margin_bottom" id="[[+name]]_wrap">
<div class="form__field__label columns two">
<label for="[[+name]]" title="[[+name:replace=`_== `:ucwords]]">[[+label:default=`[[+name:replace=`_== `:ucwords]]`]][[+req:notempty=` *`]]</label>
</div>
[[+inner_html]]
[[+note:notempty=`<span class="[[+note_class:default=`note`]]"><em>[[+note]]</em></span>`]]
[[+error:notempty=`<span class="[[+error_class]]">[[+error]]</span>`]]
</div>
</div>
<!-- select -->
<!-- radio -->
<div class="[[+outer_class]] row form__row--half_height" id="[[+name]]_wrap">
<div class="form__field__label columns two">
<label for="[[+name]]" title="[[+name:replace=`_== `:ucwords]]">[[+label:default=`[[+name:replace=`_== `:ucwords]]`]][[+req:notempty=` *`]]</label>
</div>
[[+inner_html]]
[[+note:notempty=`<span class="[[+note_class:default=`note`]]"><em>[[+note]]</em></span>`]]
[[+error:notempty=`<span class="[[+error_class]]">[[+error]]</span>`]]
</div>
</div>
<!-- radio -->
<!-- checkbox -->
<div class="[[+outer_class]] row form__row--half_height" id="[[+name]]_wrap">
<div class="form__field__label columns two">
<label for="[[+name]]" title="[[+name:replace=`_== `:ucwords]]">[[+label:default=`[[+name:replace=`_== `:ucwords]]`]][[+req:notempty=` *`]]</label>
</div>
[[+inner_html]]
[[+note:notempty=`<span class="[[+note_class:default=`note`]]"><em>[[+note]]</em></span>`]]
[[+error:notempty=`<span class="[[+error_class]]">[[+error]]</span>`]]
</div>
</div>
<!-- checkbox -->
字段类型
<!-- default -->
<input type="[[+type]]" name="[[+name]]" id="[[+key]]" value="[[+current_value:default=`[[+default]]`]]" class="[[+type]] [[+class]][[+error_class]] text" size="[[+size:default=`40`]]" placeholder="[[+default]]" />
<!-- default -->
<!-- file -->
<input type="[[+type]]" name="[[+name]][[+array:notempty=`[]`]]" id="[[+key]]" class="[[+type]] [[+class]][[+error_class]]" />
<!-- file -->
<!-- hidden -->
<input type="[[+type]]" name="[[+name]]" value="[[+current_value:default=`[[+default]]`]]" />
<!-- hidden -->
<!-- textarea -->
<textarea id="[[+key]]" class="[[+type]] [[+class]][[+error_class]]" name="[[+name]]">[[+current_value:default=`[[+default]]`]]</textarea>
<!-- textarea -->
<!-- checkbox -->
<div class="form__field__input field columns ten [[+error_class]]">
<input name="[[+name]][[+array:notempty=`[]`]]" type="hidden" value="" />
[[+options_html]]
<!-- checkbox -->
<!-- radio -->
<div class="form__field__input field columns ten [[+error_class]]">
<input type="hidden" name="[[+name]]" value="" />
[[+options_html]]
<!-- radio -->
<!-- select -->
<div class="form__field__input field columns ten [[+class]][[+error_class]]">
<input type="hidden" name="[[+name]][[+array:notempty=`[]`]]" value="" />
<div class="picker">
<select name="[[+name]][[+array:notempty=`[]`]]" id="[[+key]]" class="[[+class]] select"[[+multiple:notempty=` multiple="multiple"`]][[+title:notempty=` title="[[+title]]"`]]>
[[+header:notempty=`<option value="[[+default]]">[[+header]]</option>`]]
[[+options_html]]
</select>
</div>
<!-- select -->
<!-- static -->
<span class="static_field[[+error_class]]">[[!+[[+name]]]]</span>
<!-- static -->
<!-- submit -->
<input id="[[+key]]" class="button [[+type]] [[+class]]" name="[[+name]]" type="[[+type]]" value="[[+message:default=`Submit`]]" />
<input id="[[+name]]-clear" class="button [[+type]] [[+class]]" type="reset" value="[[+clear_message:default=`Clear Form`]]" />
<!-- submit -->
<!-- option --><option value="[[+value]]">[[+label]]</option><!-- option -->
<!-- bool -->
<label for="[[+key]]" class="[[+type]]" id="label[[+key]]">
<input name="[[+name]][[+array:notempty=`[]`]]" id="[[+key]]" value="[[+value]]" type="[[+type]]" />
<span class="[[+type]]_icon"></span>
[[+label]]
</label>
<!-- bool -->