Custom dojo tags
If you use dojo form input and want labels for them:
<label for="???">Email</label>
<input
type="text"
name="email"
dojoAttachPoint="email"
dojoType="dijit.form.TextBox"
/>
the label cannot be pressed because there is no way to find out the input identifier before rendering it.
Is there a solution for this other than hacking the id in what dojo generates for this element?
UPDATE
This is actually even more complicated than I thought, because the dojo input field is displayed as
<div class="dijit dijitTextBox" id="widget_dijit_form_TextBox_0">
<input class="dijitReset dijitInputField" value="Χ" type="text" tabindex="-1">
...
</div>
and the original input field does not have id
Have you tried to specify an identifier for input?
<label for="myIdComesHere">Email</label>
<input
id="myIdComesHere"
type="text"
name="email"
dojoAttachPoint="email"
dojoType="dijit.form.TextBox"
/>
If I remember correctly, this identifier can be used either with dojo.byId (to get the domNode aka input tag) or dijit.byId (to get the dijit widget instance)
, this.id, .
my.form, my_form_0 .
,
var id = this.id + '_email';
'<label for="' + id + '"/>'
'<input type="text" id="' + id + '"/>'
<label for="my_form_0_email"/>
<input type="text" id="my_form_0_email"/>
dijit.form.TextBox, . <input> dom , .
TextBox , :
var tb = new dijit.form.TextBox(),
label = dojo.create("label", {for: tb.id});