Ok I'm getting down the end, well end of the first release, of this project
I'm working on.
One of the last major sticking points I have is monkeying with the formlet
of a select-one-or-new tag.
What I need to do it hide one if the fields and set it's value to a
preassigned value. The field I'm hiding and presetting is a belongs_to
relationship, thus I'm getting a select-one in the formlet for the field.
I've tried the following with no luck.
<extend tag="form" for="LocationMaterial">
<old-form merge>
<field-list: fields="material, condition, potential, friable,
percent_damage, accessible, quantity, unit, notes">
<material-view:>
<select-one-or-new-dialog/>
</material-view:>
<unit-view:>
<select-one-or-new-dialog/>
</unit-view:>
</field-list:>
</old-form>
</extend>
<def tag="input" for="Material">
<select-one include-none="&false" options="&@building_materials"/>
<formlet merge>
<field-list: fields="name"/>
<after-field-list:>test this</after-field-list:>
</formlet>
</def>
Note the select-one options works fine so I'm getting into the materials
input tag but the formlet merge isn't working. In fact when I add it the
new button drops down a line in the main form. So it's doing something.
Here is the HTML without the <formlet>
<td class="material-view">
<div class="part-wrapper" id="select-one--material">
<select class="input belongs_to location_material_material"
name="location_material[material_id]">
<option value="2">Tile</option>
<option value="1">Wood</option>
</select>
</div>
<button class="hjq-dialog-open-button"
onclick="hjq.dialog_opener.click(this, jQuery('#hjq-dialog--material'));
return false;">
New
</button>
<span class="hjq-dialog-position"></span>
<!-- json_annotation
({"buttons":[["cancel","hjq.dialog.close"],["ok","hjq.dialog.submit_formlet_and_close"]],"tag":"hjq-dialog","events":{},"init":"hjq.dialog.init","options":{"title":"New
Material","autoOpen":false}}); -->
</td>
and the HTML with it notice the added part in bold
<td class="material-view">
<div class="part-wrapper" id="select-one--material">
<select class="input belongs_to location_material_material"
name="location_material[material_id]">
<option value="2">Tile</option>
<option value="1">Wood</option>
</select>
* <!-- json_annotation
({"ajax_options":{"url":null},"ajax_attrs":{},"tag":"formlet"}); -->
*
* <div class="material location-material-material formlet"
name="location_material[material]"></div>
*
</div>
<button class="hjq-dialog-open-button"
onclick="hjq.dialog_opener.click(this, jQuery('#hjq-dialog--material'));
return false;">
New
</button>
<span class="hjq-dialog-position"></span>
<!-- json_annotation
({"buttons":[["cancel","hjq.dialog.close"],["ok","hjq.dialog.submit_formlet_and_close"]],"tag":"hjq-dialog","events":{},"init":"hjq.dialog.init","options":{"title":"New
Material","autoOpen":false}}); -->
</td>
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/hobousers/-/VLEouLKccrcJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.