OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • Development and Code Review (Moderator: fabian) »
  • "for" attribute usage in form_input_tr.volt
« previous next »
  • Print
Pages: [1]

Author Topic: "for" attribute usage in form_input_tr.volt  (Read 7327 times)

NOYB

  • Jr. Member
  • **
  • Posts: 75
  • Karma: 6
    • View Profile
"for" attribute usage in form_input_tr.volt
« on: January 12, 2018, 09:25:28 am »
Having trouble understanding the "for" attribute in the <tr> (line 45) and <span> (line 81) elements here.
Could someone please shed some light on how, when, and where these are made use of?
Thanks.

form_input_tr.volt
/usr/local/opnsense/mvc/app/views/layout_partials/
Code: [Select]
45: <tr for="{{ id }}" {% if advanced|default(false)=='true' %} data-advanced="true"{% endif %}>
 . . .
        <input id="{{ id }}" ... >
 . . .
80:     <td>
81:         <span class="help-block" for="{{ id }}" ></span>
82:     </td>
83: </tr>
« Last Edit: January 12, 2018, 09:47:27 am by NOYB »
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17704
  • Karma: 1617
    • View Profile
Re: "for" attribute usage in form_input_tr.volt
« Reply #1 on: January 12, 2018, 09:52:45 am »
They are used in e.g. Services: Web Proxy pages to generate the form.


Cheers,
Franco
Logged

NOYB

  • Jr. Member
  • **
  • Posts: 75
  • Karma: 6
    • View Profile
Re: "for" attribute usage in form_input_tr.volt
« Reply #2 on: January 12, 2018, 10:49:25 am »
I know the elements (<tr> and <span>) are used in generating the form.  But what is the roll of the "for" attribute on the <tr> and <span> element there?
Thanks.
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17704
  • Karma: 1617
    • View Profile
Re: "for" attribute usage in form_input_tr.volt
« Reply #3 on: January 12, 2018, 11:22:01 am »
It's strange indeed. It should ideally mark the label "Enable proxy" and link it to the checkbox. I'd say tr-for should be dropped, and the td around span should be zapped in favour of a colspan="2" for the former column?


Cheers,
Franco
Logged

NOYB

  • Jr. Member
  • **
  • Posts: 75
  • Karma: 6
    • View Profile
Re: "for" attribute usage in form_input_tr.volt
« Reply #4 on: January 12, 2018, 11:35:39 am »
Thanks that's what I was looking for.

Seems reasonable to drop the tr-for.  Don't see how it would do anything there.

Seems reasonable to put the help-block beneath the input field.

So far I've not seen anything that actually uses the help-block to display anything there.  Is there anything that uses it or that may in the future?

Thanks
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17704
  • Karma: 1617
    • View Profile
Re: "for" attribute usage in form_input_tr.volt
« Reply #5 on: January 12, 2018, 11:51:24 am »
The help is displayed underneath like done in the static pages. There seems to be no need for the third column. But I'll ask for another opinion in a second.


Cheers,
Franco
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17704
  • Karma: 1617
    • View Profile
Re: "for" attribute usage in form_input_tr.volt
« Reply #6 on: January 12, 2018, 12:03:16 pm »
Ad said we need to be a bit careful as the MVC is used by others / external applications and there may also be code that depends on this in opnsense_ui.js still.


Cheers,
Franco
Logged

fabian

  • Moderator
  • Hero Member
  • *****
  • Posts: 2769
  • Karma: 200
  • OPNsense Contributor (Language, VPN, Proxy, etc.)
    • View Profile
    • Personal Homepage
Re: "for" attribute usage in form_input_tr.volt
« Reply #7 on: January 12, 2018, 08:07:47 pm »
@franco - the only thing I am aware of to be after the input elements are the validation messages.
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17704
  • Karma: 1617
    • View Profile
Re: "for" attribute usage in form_input_tr.volt
« Reply #8 on: January 13, 2018, 11:24:03 am »
True. Ideally, the whole thing needs a rework later this year. I also want a couple of accessibility improvements here. For now, the third column in the forms seems like wasted screen real estate, but it is what it is.


Cheers,
Franco
Logged

NOYB

  • Jr. Member
  • **
  • Posts: 75
  • Karma: 6
    • View Profile
Re: "for" attribute usage in form_input_tr.volt
« Reply #9 on: January 20, 2018, 09:57:05 am »
Over here instead
https://forum.opnsense.org/index.php?topic=6940.0
« Last Edit: January 20, 2018, 10:04:42 am by NOYB »
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • Development and Code Review (Moderator: fabian) »
  • "for" attribute usage in form_input_tr.volt
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2