Page 1 of 1

Closing </img> tag in form html

Posted: 28 Nov 2018
by Nick Jones
I've discovered an issue with a form I've created. It's a simple one, mostly checkboxes and date fields.

I added some javascript validation which didn't run. The console gave errors of unmatched end tags. I checked the code, all fine.

I removed my code (javascript and css), and still got the errors. It appears to be the table of form fields:

HTML1512: Unmatched end tag.
fd_Item_New.aspx (557, 719)

Which is this line:

<td class="ms-dtinput" >
<a href="#" onclick='clickDatePicker("ctl00_ctl38_g_1be77c03_50ac_4997_b4d2_ba7391ba2d04_Authorised_x0020_Car_x0020_Drive0Field_ctl00_ctl00_DateTimeField_DateTimeFieldDate", "\u002fSupportServices\u002fIMIT\u002fTestNLJ\u002f_layouts\u002f15\u002fiframe.aspx?&amp;cal=1&amp;lcid=2057&amp;langid=1033&amp;tz=-00:00:00.0007299&amp;ww=0111110&amp;fdow=1&amp;fwoy=0&amp;hj=0&amp;swn=False&amp;minjday=109207&amp;maxjday=2666269&amp;date=", "", event);return false;' ><img id="ctl00_ctl38_g_1be77c03_50ac_4997_b4d2_ba7391ba2d04_Authorised_x0020_Car_x0020_Drive0Field_ctl00_ctl00_DateTimeField_DateTimeFieldDateDatePickerImage" src="/_layouts/15/images/calendar_25.gif" border="0" alt="Select a date from the calendar."></img></a></td>

It appears that the forms designer has added code which includes a </img> tag (almost at the end of the code above) - which isn't needed.

How can I fix this error? Is it a bug?

Re: Closing </img> tag in form html

Posted: 28 Nov 2018
by Nikita Kurguzov
Dear Nick,
If you are not using Kendo template for Date field, the default template is rendered on the server, and we've had no input on the process, it's all default SharePoint rendering. As strange as it might seem, if it actually provides an error, it might be feasible to remove these tags with JavaScript before validation.

Re: Closing </img> tag in form html

Posted: 29 Nov 2018
by Nick Jones
Thanks Nikita

I'll try ignoring it and see if it works OK.

How would I use javascript to remove it?

Re: Closing </img> tag in form html

Posted: 29 Nov 2018
by Nikita Kurguzov
Dear Nick,
A tricky question, actually. Most browsers just fully ignore this tag, as if it's not there. Not sure why it would cause any issue. Can you tell me which browser you are using?

Technically, something like that should remove all the invalid HTML, though I still do not know why it would be interpreted by the browser in the first place:

Code: Select all

var html = $(".ms-webpart-zone").html();
$(".ms-webpart-zone").html(html);

Re: Closing </img> tag in form html

Posted: 29 Nov 2018
by Nick Jones
Thanks Nikita

It's Internet Explorer, so it's probably just the usual strangeness :)

I've ignored it, and the form seems to be working OK. I'll check in other browsers.