Hi,
I'v added a new RequiredFieldValidator and assigned a WebHtmlEditor as the control to validate. It works fine when validating, and the problem we have is that once the validation message is shown, it does not disapear when the editor is filled and loses focus.
Any suggestion?
Thanks
Hi Alejandroha,
Thank you for report.Javascript support for validators was not implemented for several reasons. One of the them, that visible content in design view may not represent actual html, and it is not possible to guess if application will consider empty object as a valid content. For example, default-empty-content in Firefox appears as "<br>". After cut/remove or change color/font, etc. the html-content may appear as "<font some-attributes></font>" or "<span some-attributes></span>". Also html-content may have invisible objects like <script>, <style>, etc.
Support for validators on client was reviewed and validation for most actions will be implemented.For now application may implement that by something like below.Underlined are key-statements and the rest is optional.
<script type="text/javascript">function editorChange(oEditor){ // perform validation with (10ms) delay, // because actual change may happen not at processed event, but slightly later setTimeout(function () { var elem = oEditor._elem0; //or //var elem = document.getElementById(oEditor.ID); // short-cut for element which holds validators created by server var validator = oEditor._validator; if(!validator) { // try to find element which holds validators created by server var inputs = elem.getElementsByTagName('INPUT'); // ensure that ValidatorOnChange function is available var i = window.ValidatorOnChange ? inputs.length : 0; while(i-- > 0 && !validator) if(inputs[i].Validators) validator = inputs[i]; // create a short-cut for element which holds validators oEditor._validator = validator = validator || 'none'; } if(validator == 'none') return; // get current text in editor var text = oEditor.getText().toLowerCase(); // optional: remove empty <font> object if(text.indexOf('<font') == 0) { text = text.substring(text.indexOf('>') + 1); if(text.indexOf('</font>') == 0) text = text.substring(7); } // optional: remove empty <span> object if(text.indexOf('<span') == 0) { text = text.substring(text.indexOf('>') + 1); if(text.indexOf('</span>') == 0) text = text.substring(7); } // optional: remove empty <br>, <p> objects if(text == '<br>' || text == '<br/>' || text == '<br />' || text == '<p></p>' || text == '<p> </p>') text = ''; // set property for target-element expected by server-validators elem.value = text; // trigger validation window.ValidatorOnChange({ srcElement: validator }); }, 10);}</script><ighedit:WebHtmlEditor ID="WebHtmlEditor1" runat="server" ...> <ClientSideEvents AfterAction="editorChange" KeyDown="editorChange" Blur="editorChange" /></ighedit:WebHtmlEditor>
Hi Maya,
I'm using the same version you mention. I've made a little change to the files you attached to make easier to explain the scenario I'm facing. Here is what I'm doing:
1. Leave the fields empty.
2. Click on the button so the validator message appears.
3. Start writing some text in the html editor.
4. Move to the other field.
After step 4, I would expect the validation message to disappear.
I've solved this adding some javascript, but I was expecting a way to get the same behavior that for other controls.
Hello alejandroha ,
I'm just following up to whether you still need assistance with this.
If so don't hesitate to contact me.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
I’ve tested your scenario with the latest service release of 11.2 (11.2.20112.2086) and couldn’t reproduce your issue.
Could you let me know which version of Ig controls are you currently using and which service release version?
I’m attaching the sample I tested it on. Let me know if you’re doing anything different.
I’m looking forward to your reply.
Hi alejandroha,
My name is Troy and I will be looking into your inquiry for you. I will follow-up with you an update on or before Wednesday.