Project

General

Profile

Bug #7057

Hidden field displays in browser

Added by Stilez y 10 months ago. Updated 8 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Web Interface
Target version:
Start date:
12/31/2016
Due date:
% Done:

0%

Affected Version:
2.3.x
Affected Architecture:

Description

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>

floating.png (6.71 KB) Stilez y, 12/31/2016 03:38 AM

History

#1 Updated by Phillip Davis 10 months ago

PR https://github.com/pfsense/pfsense/pull/3329
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' ?

#2 Updated by Jim Thompson 10 months ago

  • Assignee set to Steve Beaver

#3 Updated by Steve Beaver 10 months 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.

If you need your hidden element to be un-hidden at some point though, use the Javascript functions for this. Try:

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.

#4 Updated by Steve Beaver 10 months ago

  • Status changed from New to Resolved

#5 Updated by Jim Pingle 8 months ago

  • Category set to Web Interface
  • Target version set to 2.3.3
  • Affected Version set to 2.3.x

Also available in: Atom PDF