How do I add an id field to #textbox that also renders in HTML? (Plus other questions)

How do i add an actual id field to a #textbox? So far I have the following code:

%% -*- mode: nitrogen -*-

-module(accounts_signup).

-compile(export_all).

-include_lib("nitrogen_core/include/wf.hrl").

main() -> #template{file = "./site/templates/bare.html"}.

title() -> "Ookma-Kyi - Signup".

body() ->

    #container_12{

        body = [

            #grid_8{alpha = true, prefix = 2, suffix = 2, omega = true, body = inner_body()}

        ]

    }.

inner_body() ->

    [

        #h1{text = "Signup"},

        #p{},

        "

\n"

        "        Please fill out the application below to register for an account.

\n"

        "        ",

        #label{for = username, text = "Username"},

        #textbox{id = username},

        #label{for = email, text = "Email"},

        #textbox{id = email},

        #label{for = password, text = "Password"},

        #password{id = password},

        #label{for = passwordconfirm, text = "Confirm Password"},

        #password{id = confirmpassword},

        #br{},

        #button{text = "Signup"}

    ].

However it is rendering this html:

<label class="wfid_temp1027 nitrogen_label" for="username" >Username</label>
<input type="text" autocomplete="off" class="wfid_username wfid_temp1059 textbox" value="" />
<label class="wfid_temp1091 nitrogen_label" for="email" >Email</label>
<input type="text" autocomplete="off" class="wfid_email wfid_temp1123 textbox" value="" />

Note there is no id parameter in the textfields itself.

Also I tried:

#textbox{id = username, aria-describeby=usernameHelpBlock }

and it produced an error.

3 Likes

Never used Nitrogen, but according to nitrogren-core/include/wf.hrl I think that you should use html_id for that purpose, not id.

2 Likes

Thanks, just took a quick peek because I was afraid of messing it up and noted that a search of aria produced no results. Does this mean nitrogen doesn’t support the aria-describedby tag?

Citation: aria-describedby - Accessibility | MDN

EDIT: Dumb question, Why was my quote removed?

2 Likes

Correct. Aria fields will be added in Nitrogen 3.

I don’t know what happened to a quote of yours

2 Likes

If you click on the pencil icon in the top right of your post it will give you a diff of edits with a reason at the top:

:smiley:

1 Like