Project

General

Profile

Bug #7083

Put back some visual hint for required fields

Added by Kill Bill 4 months ago. Updated 3 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Web Interface
Target version:
Start date:
01/05/2017
Due date:
% Done:

0%

Affected version:
2.3.x
Affected Architecture:
All

Description

Pretty sure the convention was that the <fielddescr> for a <required/> field was shown in bold in pfSense before 2.3. That's definitely gone with bootstrap conversion, now everything is bold there, so - without further description - it's impossible for users to say which fields must be filled in and which are optional.

The "bold" fontface was not a good hint anyway, using some small icon, or color, or something else would be definitely useful though.

required.jpg (55.8 KB) Steve Beaver, 01/19/2017 10:51 AM

DialOnDemandCheckbox.gif (32.1 KB) Phillip Davis, 01/20/2017 01:05 AM

Associated revisions

Revision 57026d17
Added by Steve Beaver 3 months ago

Fixed #7083

When composing an element with a form.class or via XML, prepend a '*' to the title to indicate a required field. This will cause the "element-required" class to be added to the label. pfSense.css contains the style associated with that class. (Currently a custom underline).

e.g.:

$section->addInput(new Form_Input(
'name',
'*Name',
'text',
$pconfig['name']
))->setPattern('[a-zA-Z0-9_]+')->setHelp('The name of the alias may only consist '.
'of the characters "a-z, A-Z, 0-9 and _".');

History

#1 Updated by Steve Beaver 3 months ago

  • Status changed from New to Feedback

Added:

When composing an element with a form.class or via XML, prepend a '*' to the title to indicate a required field. This will cause the "element-required" class to be added to the label. pfSense.css now contains the style associated with that class. (Currently a custom underline).

e.g.:

$section->addInput(new Form_Input(
'name',
'*Name',
'text',
$pconfig['name']
))->setPattern('[a-zA-Z0-9_]+')->setHelp('The name of the alias may only consist '.
'of the characters "a-z, A-Z, 0-9 and _".');

#2 Updated by Steve Beaver 3 months ago

pkg_edit.php has been updated to automatically add the '*' if <required> is set

#3 Updated by Steve Beaver 3 months ago

  • % Done changed from 0 to 100

#4 Updated by Steve Beaver 3 months ago

  • Assignee changed from Steve Beaver to Kill Bill
  • % Done changed from 100 to 0

#5 Updated by Steve Beaver 3 months ago

#6 Updated by Kill Bill 3 months ago

Works nicely (tested with a recent 2.3.3 snapshot and bunch of packages - squid, ntopng, shellcmd, ftpproxy). Thanks.

#7 Updated by Renato Botelho 3 months ago

  • Status changed from Feedback to Resolved

#8 Updated by Phillip Davis 3 months ago

Sometimes the "required" status of a field is data dependent and needs to be set/cleared as the page loads depending on the data in other fields, and as the user changes the data in other fields. So some pages may want to addClass('element-required') and removeClass('element-required') on-the-fly.
Here is an example on the Interfaces page:
https://github.com/pfsense/pfsense/pull/3406

It would be nice to have infrastructure that provides some "easy" way to find the relevant span tag and adjust its class(es) on-the-fly.

#9 Updated by Phillip Davis 3 months ago

Dependency between Dial On Demand checkbox and Idle Timeout field

#10 Updated by Steve Beaver 3 months ago

I have added a new function to pfSenseHelpers.js to allow an input to be dynamically set as required (or not). e.g.:

setRequired('descr', true);   // set the element named 'descr' to be a required input by adding 
                              // the 'element-required' class to its label

#11 Updated by Jim Pingle 3 months ago

  • Status changed from Resolved to Assigned
  • Assignee changed from Kill Bill to Steve Beaver
  • Target version changed from 2.4.0 to 2.3.3

Looks like this was partially merged back to 2.3.3 but not all of it. Fields have the * before the name and are not showing the underline formatting.

#12 Updated by Steve Beaver 3 months ago

The mechanism required to do this has been ported to 2.3.3 but it looks like quite a few pages do not yet have the '*' to indicate a required field. Tested with vpn_openvpn_server.php

#13 Updated by Phillip Davis 3 months ago

Reported in forum: https://forum.pfsense.org/index.php?topic=125403.0
I am seeing the "*" displayed in the (some) places where it is backported to 2.3.3, but it is not being converted to an underline. I did a full ctrl-F5 to make sure my browser reloaded all its JS.

#14 Updated by Steve Beaver 3 months ago

On which page do you see that Phil?
I assumed you synced in the last few minutes?

#15 Updated by Phillip Davis 3 months ago

Oh, I see now that you just committed that supporting code to RELENG_2_3. I noticed the issue this morning my time (whenever I posted that on the forum - maybe 10 hours ago. I will update my 2.3.3 VM now.
Updated VM is working fine, thanks. Required fields are underlined.

Now I think it is just that not all the '*' required field markings have been back-ported. So some GUI pages have the underlining and others do not. That makes the UI inconsistent, but does not break anything.

#16 Updated by Phillip Davis 3 months ago

I have noted on GitHub a couple of commits in master that did not get back-ported. @rbgarga is back-porting them right now. I also noticed 1 other field that could be marked required in firewall_aliases_edit - PR https://github.com/pfsense/pfsense/pull/3523 - that could also go back to RELENG_2_3
That should make everything consistent between 2.4 and 2.3.3

#17 Updated by Renato Botelho 3 months ago

  • Status changed from Assigned to Feedback

I believe it's all done now

#18 Updated by Renato Botelho 3 months ago

  • Status changed from Feedback to Resolved

Everything looks OK now. Thanks Phil!

Also available in: Atom PDF