If you do not use frontend_model
your html for two fields will look like this
<tr id="row_you_dependency_field_id">
<td class="label"><label for="you_dependency_field_id">Dependency Field</label></td>
<td class="value">
<select id="you_dependency_field_id" name="groups[general][fields][you_dependency_field_id][value]" class=" select">
<option value="1">Yes</option>
<option value="0" selected="selected">No</option>
</select>
</td>
</tr>
<tr id="row_your_dependent_field_id">
<td class="label">
<label for="your_dependent_field_id">Dependent Field</label>
</td>
<td class="value">
<select id="your_dependent_field_id" name="groups[general][fields][your_dependent_field_id][value]" class=" select">
<option value="1">Yes</option>
<option value="0" selected="selected">No</option>
</select>
</td>
</tr>
And theThe javascript to show hide/hide dependent field will look like this
new FormElementDependenceController({"your_dependent_field_id":{"you_dependency_field id":"1"}});
And show/hide will work fine because both ids are present in html.
But if you use frontend_model
the value for the second field is rendered by your custom block module/adminhtml_form_field_test
and does not contain id of the dependent field and javascript just does not know what to hide.
<tr id="row_you_dependency_field_id">
<td class="label"><label for="you_dependency_field_id">Dependency Field</label></td>
<td class="value">
<select id="you_dependency_field_id" name="groups[general][fields][you_dependency_field_id][value]" class=" select">
<option value="1">Yes</option>
<option value="0" selected="selected">No</option>
</select>
</td>
</tr>
<tr id="row_your_dependent_field_id">
<td class="label">
<label for="your_dependent_field_id">Dependent Field</label>
</td>
<td class="value">
...
//The output of your frontend_model
...
</td>
</tr>
When you generate html in yourSo go to _toHtml() method of frontend_modelmodule/adminhtml_form_field_test
justand wrap yourthe output into div
and specify id for it
$fieldId = $this->getElement()->getId();
//your html
<div id="field id here">
//your frontend_model html
</div>