javascript - How can I use dojo.destroy and dojo.create in a phone validation scenario? -


i have problem have phone input field connected dojo dropdown widget. can select phone type or international phone type. if select type can enter 10 characters in input field. if select international type can put 15 characters in input field. working correctly in firefox , internet explorer 8 not working correctly in internet explorer 7.

here html code:

<input id="tphone" type="text" name="tphone" class="iscompleted phone-number" tabindex="0" maxlength="10" rel="i13"/> 

i figure can working right in dojo if dynamically alter or destroy dom node , replace based on selection user makes. how can dojo? here dojo code have now:

this.phonetypedrop = new widget.styleddropdown(dojo.byid("sphonetype"),function(){         if(_this.phonetypedrop.getselectedindex() == 0){             phone.pnfield.regex = validation.regexps.phone;             dojo.attr(dojo.byid(phone.pnfield.id),"maxlength", 10);         }else{             phone.pnfield.regex = validation.regexps.phoneinternational;                 dojo.attr(dojo.byid(phone.pnfield.id),"maxlength", 15);         } },true,64); 

i fixed it. ie can pain. check of colleague , ie7 excepts different syntax other browsers maxlegnth. uses maxlegnth capital "l". code looks now:

this.phonetypedrop = new widget.styleddropdown(dojo.byid("sphonetype"),function(){     if(_this.phonetypedrop.getselectedindex() == 0){         phone.pnfield.regex = validation.regexps.phone;         dojo.attr(dojo.byid(phone.pnfield.id),"maxlength", 10);     }else{         phone.pnfield.regex = validation.regexps.phoneinternational;             dojo.attr(dojo.byid(phone.pnfield.id),"maxlength", 15);     } },true,64); 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -