I have a WebDateTimeEdit control that works fine, except when a MS required field validation control is used with it.
I set the SetFocusOnError property of the validator control to True, but it doesn't set focus on the control when left blank.
Is there an easy workaround, using vbscript?>
Hi,
Thank you for report. That feature was missed. Now it has been implemented and coming service releases will contain that (next one probably will not have it yet).
If you need it urgently, then I can give you "fix" codes which can be used to hack into current implementation. You may use a single function for all editors on page.
<script type="text/javascript">function initEdit(oEdit){ oEdit.valid = function(v) { if(!this.msV(v) || this.fcs < 0 || !window.ValidatorOnChange) return; var ev = this.elemValue, e = this.elem; try { v = ev.Validators; e.Validators = v; var i = (v && window['Page_InvalidControlToBeFocused'] == null) ? v.length : 0; ValidatorOnChange({srcElement:ev}); while(i-- > 0) if(v[i].focusOnError == 't' && v[i].isvalid === false) { window['Page_InvalidControlToBeFocused'] = e; this.focus(); break; } }catch(e){} }}</script><igtxt:WebMaskEdit ID="WebTextEdit1" runat="server"> <ClientSideEvents Initialize="initEdit" /></igtxt:WebMaskEdit>