I found that the main page of your livetest website at http://livetest.ubercart.org/ does validate but inner product page does not validate XHTML. Can it show green bar when validating through validator.w3.org
Making Valid XHTML Strict
|
|
Can you list up here the errors you were getting? 
From, http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Flivetest.uberca...
there is no attribute "nowrap" ---> th nowrap="nowrap">Add to cart
and
there is no attribute "width" ---> td width="100%"
and
ID "edit-submit" already defined ---> input type="submit" name="op" id="edit-submit" value="Add to cart" class="form
and
ID "edit-nid" already defined ----> input type="hidden" name="nid" id="edit-nid" value="5"
you need to remove nowrap and width from the above and I think defining add to cart/submit buttons with "class" rather than "id" can solve the problem.
These are the main problem. I think if these are sorted out all the inner product pages will start to valid xhtml.
Line 156, Column 35: ID "edit-submit" already defined.
input type="submit" name="op" id="edit-submit" value="Add to cart" class="form
An "id" is a unique identifier. Each time this attribute is used in a document it must have a different value. If you are using this attribute as a hook for style sheets it may be more appropriate to use classes (which group elements) than id (which are used to identify exactly one element).
--
The problem is that every "add to cart" and "edit-qty" submit button has the same id
any suggestions?
Thanks!
This is a big problem for me too, because I would like every page of my site to validate and still I would like to have "add to cart" button and "quantity" field on my product page. If i remove them everything validates okay.
Also I noticed a bug in the uc_catalog.module - on line 1145 we have
"$product_table .= '</td>';"but it should be after the else closure, just move it two lines below and place it on line 1147.
Finally I have managed to validate my product page with the quantity fields and submit buttons on it. What I did was to edit the the includes/form.inc file and generate a random number before each ID and added to it for text fields and buttons. After that I have removed the ID reference from the labels above because they generated warnings (not errors but still unsatisfying) about non-existent ID's. Now I have to do heavy testing to see if this messed up with something else. If you have done that 'random-id' thing before and saw some negative effects, please share.
The first problem after editing the Form API file i noticed is that the expandable areas in edit node for example stopped expanding because of the messed up reference between the label and the area. Any ideas?
I'm working on fixing the same thing on my site.
Couldn't you just change the ID's to classes?
txcrew
EDIT: Sorry I didn't see that it was Drupal core files and not ubercart core files. I think I answered my own question.
html valid sites should be able to happen with ubercart – my sites are otherwise fully valid, except for the pages where products are listed as teasers... same errors as above
Thanks in advance for help with this! (a patch would be great!)
Scott
Hi txcrew,
I don't understand – why can't classes be substituted for IDs?
Or how about the suggestion to append the "edit-submit" with a number – like Node ID? 'edit-submit'.$node->nid ... that way if they need to be IDs, they'd all be unique, and predictable (in case that's important)?
Because this is not something that's wrong with Ubercart - it's a problem with *Drupal*. The fix would have to be made in Drupal core. You're welcome to push the issue on drupal.org to try to get a fix into Drupal 5.x, but I doubt there will be another release of Drupal 5.x just to fix bugs like this. I believe this particular issue is resolved in Drupal 6.x, but I haven't verified that myself.
If it's a big problem for you, you could always hack Drupal core like acdtrp did by modifying includes/form.inc. That would be the appropriate place to look to change the ids to classes. Be aware that in doing this you might break some jQuery code in Drupal, Ubercart and other modules if it selects based on id, and you might have to change some of the css generated by Drupal, Ubercart, and your theme. acdtrp mentioned that became a problem when he modified the core...
the "edit-submit" problem is fixed in Drupal 6
http://drupal.org/node/111719
and the workaround in Drupal 5
http://drupal.org/node/269869
can a similar solution be used for the edit-qty issue?
From w3 validator:
Line 160, Column 41: ID "edit-qty" already defined.
<div><input type="hidden" name="qty" id="edit-qty" value="1" />
An "id" is a unique identifier. Each time this attribute is used in a document it must have a different value. If you are using this attribute as a hook for style sheets it may be more appropriate to use classes (which group elements) than id (which are used to identify exactly one element).<?php
function phptemplate_hidden($element) {
static $dupe_ids = array();
if (isset($dupe_ids[$element['#id']])) {
$dupe_ids[$element['#id']]++;
$element['#id'] = $element['#id'] .'-'. $dupe_ids[$element['#id']];
}
else {
$dupe_ids[$element['#id']] = 0;
}
return '<input type="hidden" name="'. $element['#name'] . '" id="'. $element['#id'] . '" value="'. check_plain($element['#value']) ."\" " . drupal_attributes($element['#attributes']) ." />\n";
}
?>|
|






Joined: 12/11/2007