EasyUI Forum

General Category => Bug Report => Topic started by: it-leon on July 08, 2015, 08:21:06 PM



Title: label for and tabindex can't using
Post by: it-leon on July 08, 2015, 08:21:06 PM
label for can't using

click label focus will at input  but it is not like this
================================1===========================================
<label id="quo_no_t" for="quo_no"><span class="labelContent" itdept-ui="true">Quotation No.</span>: </label>

but input no id  not general quo_no

<span class="textbox" style="width: 138px; height: 20px;"><input type="text" autocomplete="off" class="textbox-text validatebox-text" placeholder="" style="margin-left: 0px; margin-right: 0px; padding-top: 2px; padding-bottom: 2px; width: 130px;"><input type="hidden" class="textbox-value" name="quo_no" value="qqq"></span>

===========================================================================


================================2===========================================

i using html helper

C#
   var lhtml_quo_no            = Html.itUI().UITextbox("quo_no", ls_module, "").multiLine(false);
  @lhtml_quo_no.td(1, 2).label("sales.label.quo_no").tabIndex(1) <-- here

HTML
<input type="text" value="" (tabindex="1" here is not good ) ng-model="cntrl_data.maint.sch_crit.quo_no" ittextbox="" id="quo_no" data-itdept-type="itTextbox" data-itdept-options="&quot;width&quot;:140,&quot;width&quot;:140" class="ng-untouched ng-valid textbox-f ng-dirty ng-valid-parse" style="display: none;" textboxname="quo_no" itdept-ui="true">

this html can't not found  tabindex
<input type="text" autocomplete="off" class="textbox-text validatebox-text" placeholder="" style="margin-left: 0px; margin-right: 0px; padding-top: 2px; padding-bottom: 2px; width: 130px;">

 ::)

===========================================================================





Title: Re: label for and tabindex can't using
Post by: jarry on July 09, 2015, 03:00:33 AM
When using textbox component, the input box is not the original <input> element, so the 'id' and 'tabindex' attributes are not attached to this input box. To solve this issue, please try the following code.
Code:
<script type="text/javascript">
$(function(){
$('.textbox-text').each(function(){
var t = $(this).parent().prev();
$(this).attr('id', t.attr('id') ? t.attr('id')+'-textbox' : '');
$(this).attr('tabindex', t.attr('tabindex'));
})
})
</script>
<label for="e1-textbox">label</label>
<input id="e1" class="easyui-textbox" tabindex="2">

Please notice that the <label> element's id attribute value must have a '-textbox' suffix.