VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Jörgen on May 13, 2015, 19:12:05 PM

Title: Validation error in module mod_virtuemart_search VM 3.0.8
Post by: Jörgen on May 13, 2015, 19:12:05 PM
There is a validation error in modules/mod_virtuemart_search/tmpl/default.php line 6

<?php $output '<input name="keyword" id="mod_virtuemart_search" maxlength="'.$maxlength.'" alt="'.$button_text.'" class="inputbox'.$moduleclass_sfx.'" type="text" size="'.$width.'" value="'.$text.'"  onblur="if(this.value==\'\') this.value=\''.$text.'\';" onfocus="if(this.value==\''.$text.'\') this.value=\'\';" />';


Validation error:
QuoteAttribute alt not allowed on element input at this point.

The attribute alt is only allowed for type="image". Alt should be removed:
<?php $output '<input name="keyword" id="mod_virtuemart_search" maxlength="'.$maxlength.'" class="inputbox'.$moduleclass_sfx.'" type="text" size="'.$width.'" value="'.$text.'"  onblur="if(this.value==\'\') this.value=\''.$text.'\';" onfocus="if(this.value==\''.$text.'\') this.value=\'\';" />';

The alt attribute should probably be moved to line 11:
$button = '<input style="vertical-align :middle;height:16px;border: 1px solid #CCC;" type="image" alt="'.$button_text.'" value="'.$button_text.'" class="button'.$moduleclass_sfx.'" src="'.$image.'" onclick="this.form.keyword.focus();"/>';

A fix can in the mean time be applied to an override in Your template directory: templates/your_template/html/mod_virtuemart_search/default.php

best regards

Jörgen @ Kreativ Fotografi

Title: Re: Validation error in module mod_virtuemart_search VM 3.0.8
Post by: Studio 42 on May 14, 2015, 03:16:01 AM
Hi,
I don't know why so many programmer(and template maker use alt in another case as for images.
title is the only attribute to use when the html tag is not img (if this have a sens, most of time only for A tag).
All this to say i approve your codes fixes ;)
Title: Re: Validation error in module mod_virtuemart_search VM 3.0.8
Post by: Jörgen on May 14, 2015, 12:59:03 PM
Hi Studio 42

Great suggestion, didn´t think of using title. So instead of using alt on line 6 title could be used:
<?php $output '<input name="keyword" id="mod_virtuemart_search" maxlength="'.$maxlength.'" title="'.$button_text.'" class="inputbox'.$moduleclass_sfx.'" type="text" size="'.$width.'" value="'.$text.'"  onblur="if(this.value==\'\') this.value=\''.$text.'\';" onfocus="if(this.value==\''.$text.'\') this.value=\'\';" />';

Together with adding the alt code in line 11.
$button = '<input style="vertical-align :middle;height:16px;border: 1px solid #CCC;" type="image" alt="'.$button_text.'" value="'.$button_text.'" class="button'.$moduleclass_sfx.'" src="'.$image.'" onclick="this.form.keyword.focus();"/>';

regards

Jörgen @ Kreativ Fotografi