我假設你可以在HTML :: FormFu中使用XML :: Simple,因爲FromFu使用Config :: Any來加載它的配置數據。如何使用XML :: Simple來配置HTML :: FormFu?
但是,我似乎無法找到任何XML :: FormFu使用示例XML配置。我不僅得到一個錯誤。我不確定我的xml結構是否正確以創建所需的表單。例如,在選項上,formfu需要一個數組參考數組。但我很確定這個XML會產生一個哈希引用數組。
我沒有做正確的事情......這是我的XML文件的開頭:
<?xml version="1.0" encoding="utf-8" ?>
<config>
<indicator>submit</indicator>
<elements>
<element type="FieldSet" name="overrides" label="Over Rides">
<attributes title="Use these fields to override the csv value with this constant value" />
<elements>
<element type="text" name="client" label="Client" />
<element type="Select" name="bid_type" label="Bid Type">
<options bid="Bid" />
<options approved="Approved" />
</element>
<element type="text" name="client_pay" label="Client Pay" />
<element type="text" name="due_date" label="Due Date" />
<element type="text" name="start_date" label="Start Date" />
<element type="Radiogroup" name="category" label="Category">
<options grass_cut_initial="Grass Cut - Initial"/>
<options grass_cut_recut="Grass Cut - Recut"/>
<options secure="Secure"/>
<options winterization="Winterization"/>
<options rehab="Rehab" />
<options custom="Custom"/>
</element>
<element type="text" name="contractor" label="Contractor" />
<element type="text" name="contractor_pay" label="Contractor Pay" />
</elements>
</element>
我得到這個錯誤:
[debug] Catalyst::Controller::HTML::FormFu::Action::FormConfig loading config file 'workorders/import' [error] Caught exception in myapsjobs::Controller::WorkOrders->import "Error parsing /home/jon/aps-dev/myapsjobs/root/forms/workorders/import.xml: /home/jon/aps-dev/myapsjobs/root/forms/workorders/import.xml:38: parser error : Premature end of data in tag config line 1 at /usr/local/share/perl/5.10.0/HTML/FormFu/ObjectUtil.pm line 502"
是否有某些特定原因希望使用XML?例如,你是否從其他工具動態創建配置? – 2009-12-23 02:32:33