简体   繁体   中英

Dojo ValidationTextBoxes blur focus… on focus

Using Dojo 1.7, my ValidationTextBox or NumberTextBox widgets don't hold focus.

<input name="mm" id="mm" data-dojo-type="dijit.form.TextBox" data-dojo-props="placeholder:'Month', required:true" />
<input name="dd" id="dd" data-dojo-type="dijit.form.NumberTextBox" data-dojo-props="size:2,placeholder:'Day',required:true" />
<input name="yy" id="yy" data-dojo-type="dijit.form.TextBox" data-dojo-props="size:4,placeholder:'Year',required:true" />

If a value is deemed invalid, the tooltip shows, says the "invalid" message, but when I click on the textbox to change or add in the correct value, the textbox loses focus, and in this case it focus is sent back to the first textbox. I've had this issue before and almost abandoned the validation part, but this seems like a silly issue. All searches end in frustration, as does the entirety of Dojo's "documentation".

Does it in latest Chrome, FF and Safari builds which tells me it's not a browser issue.

Finally I can found it.

From your website Your </label> is the principal.

Originally your </label> is stay next to <input ....dojo.... />

You have to move the </label> stay before <input ....dojo.... />

like this

<label><span>City of Residence</span></label>
<input id="local" name="local" data-dojo-type="dijit.form.TextBox" />

<label class="reqd"><span>Birthday</span></label>
<input name="mm" id="mm" data-dojo-type="dijit.form.TextBox" data-dojo-props="placeholder:'Month', required:true" />

Thank you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM