-
MODX Staff
- 2,502 Posts
AjaxSearch will
not validate the way it is written as it is
not valid. Period.
Edited as I have reviewed the W3C spec and noted that this is a valid method for establishing labeling.
In order to make it valid you have to change the /assets/snippets/AjaxSearch/inlcudes/templates.inc.php
The problem is that you cannot have an <input> nested in a <label> as is in the default template.
Here is what I changed it to (starting around line 18 after ’form’ => ’):
<form [+as.formId+]action="[+as.formAction+]" method="post">
<div><label for="ajaxSearch_input">Search</label>
<input id="ajaxSearch_input" type="text" name="search" value="[+as.inputValue+]"[+as.inputOptions+]></div>
<div><label for="ajaxSearch_submit"> </label>
<input id="ajaxSearch_submit" type="submit" name="sub" value="[+as.submitText+]"></div>
</form>
This is still not ideal I still don’t like it as it uses empty elements (<label>) to display results but this will validate in HTML 4.01 or XHTML 1.0 Strict.
Hope this helps.
I have also written a
plugin that will strip out the end slash in self-closing elements (will post link as soon as I can find it.)
Cheers,
Jay
Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup
magician.
Blog ✦
Twitter ✦
LinkedIn ✦
GitHub
-
MODX Staff
- 12,272 Posts
Some Javascript libraries require valid XHTML doctypes in order to work reliably if that’s important to you at all, including Mootools which drives Ajax Search and Quick Edit. While it can be a bit frustrating getting cross-platform/browser results, I think the benefits of using XHTML layouts far outweigh any drawbacks. I’ve not built an non-XHTML site in more than 3 years.
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
-
MODX Staff
- 2,502 Posts
Ryan you are absolutely right about Javascript Libraries and XHTML.
Personally, fall into the category of HTML purists who argue that since no browser accepts XHTML as anything other than text/html vs application/xml and all the people who have started using XHTML have done so because someone who built their WYSIWYG editor decided that since XHTML is newer than HTML4.01 we should use it as the default. Unfortunately there are far too many people developing around XHTML and its DOM handlers in the browsers which has meant that I had to swallow my righteous pride and slap on the X every once and a while. 90% of my sites are written using HTML 4.01 and even with some JS libraries as I use so few of the DOM features I don’t need to change. Even though Betamax and Blue Ray were/are better we had VHS and will have HD DVD. Majoruty rules and majority is using XHTML.
I think that HTML 5 will help bring back the sanity to the world of strict HTML documents.
BTW, There is nothing wrong with XHTML except it was never intended to replace HTML but to integrate XML application function to the interface.
Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup
magician.
Blog ✦
Twitter ✦
LinkedIn ✦
GitHub