We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28451
    • 46 Posts
    Hello,

    I use AjaxSearch, and it’s the last piece of my template that won’t validate, I hope one of you can help me out.

    I have this code:

    <div id="ajaxsearch">
    	<form action="soegeresultater" method="post">
    		<label for="ajaxSearch_input">
    			<input id="ajaxSearch_input" type="text" name="search" value=" Søg her" onfocus="this.value=(this.value==' Søg her')? '' : this.value ;" />
    		</label>
    
    		<label for="ajaxSearch_submit">
    			<input id="ajaxSearch_submit" type="submit" name="sub" value="" />
    		</label>
    	</form>
    
    	<p class="ajaxSearch_intro" id="ajaxSearch_intro">Skriv venligst et eller flere ord for at starte din søgning.</p>		
    </div>


    And the validator tells me this:

    document type does not allow element "label" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.

    <label for="ajaxSearch_input">

    The mentioned element is not allowed to appear in the context in which you’ve placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you’ve forgotten to close a previous element.

    One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

    It says that for both the labels. Does anyone know what I’ve done wrong here? Thankyou in advance.
      • 4310
      • 2,310 Posts
      I think you need...
      <div id="ajaxsearch">
      	<form action="soegeresultater" method="post">
      <fieldset>
      		<label for="ajaxSearch_input">
      			<input id="ajaxSearch_input" type="text" name="search" value=" Søg her" onfocus="this.value=(this.value==' Søg her')? '' : this.value ;" />
      		</label>
      
      		<label for="ajaxSearch_submit">
      			<input id="ajaxSearch_submit" type="submit" name="sub" value="" />
      		</label>
      </fieldset>
      	</form>
      
      	<p class="ajaxSearch_intro" id="ajaxSearch_intro">Skriv venligst et eller flere ord for at starte din søgning.</p>		
      </div>

      note the <fieldset> </fieldset>opening and closing tags.

      David
        • 28451
        • 46 Posts
        Makes sense, but where do I insert it? smiley
          • 4310
          • 2,310 Posts
          I reposted your template chunk with the correct tags inserted.
          Just copy and paste it into your current chunk and try it.

          David
            • 28451
            • 46 Posts
            Nevermind, I found the template-file, and now it validates, woohoo! wink

            So... I wonder why it isn’t there as default? is it just an oversight, or is there a reason?
              • 28451
              • 46 Posts
              I see, I haven’t set a templatechunk, so it uses the default.
                • 28451
                • 46 Posts
                So - thankyou very much for your help there. I couldn’t figure it out since I thought it was all coded in the snippet, but now I know of the templatechunk option, that will be useful in the future. smiley
                  • 4310
                  • 2,310 Posts
                  Sorry Steffan, I hadn’t looked carefully, most snippets have separate chunks for styling the output, I didn’t realise AjaxSearch was different.