Hidden field displays in browser
firewall_rules_edit.php on Firefox 50.1, see attached screenshot
Html looks correct (contains "hidden" parameter) so why isn't it being hidden as expected?
</div> <div class="form-group"> <label class="col-sm-2 control-label"> Floating </label> <div class="col-sm-10"> <input class="form-control" name="floating" id="floating" type="hidden" value="floating"> </div>
#1 Updated by Phillip Davis over 2 years ago
I made the "Floating" field be created with the same construction as other hidden fields in firewall_rules_edit, taking it out of the section and now it does not display.
I haven't looked under the hood at all - perhaps something in addInput() needs to be fixed to handle 'hidden' ?
#3 Updated by Steve Beaver over 2 years ago
Using the addGlobal() method is the best way to do this as Phil has demonstrated. That creates a simple input without the div, label and help text that would be added with an addInput() call.
Otherwise the input is hidden, but the label you specified, and the form-group that surrounds it are not.
hideInput("floating", true); in the JS
That function locates the input, then locates the parent div and hides the whole thing.
While it would be possible to modify Sjon's Form_Input class to NOT render the div or the label if the input type is hidden, that may well break other things and it seems to me that the existing methods work well enough.