Product listing pages with add-to-cart button don't pass HTML validation

Project: 
Ubercart
Category: 
bug report
Priority: 
normal
Status: 
active

This seems to be because the submit button elements are not getting unique ID attributes. A quick fix for me was to do this:

CHANGE

<?php
function uc_catalog_buy_it_now_form($node){
 
$form = array();
 
$form['#base'] = 'uc_catalog_buy_it_now_form';
 
$form['nid'] = array('#type' => 'hidden', '#value' => $node->nid);
 
$form['submit'] = array('#type' => 'submit', '#value' =>  variable_get('uc_teaser_add_to_cart_text', t('Add to cart')), );
  return
$form;
}
?>

TO

<?php
function uc_catalog_buy_it_now_form($node){
 
$form = array();
 
$form['#base'] = 'uc_catalog_buy_it_now_form';
 
$form['nid'] = array('#type' => 'hidden', '#id' => 'edit-nid-'. $node->nid, '#value' => $node->nid);
 
$form['submit'] = array('#type' => 'submit', '#id' => 'edit-submit-'. $node->nid, '#value' =>  variable_get('uc_teaser_add_to_cart_text', t('Add to cart')), );
  return
$form;
}
?>

You probably would want to do something a little better with trees or something, I just didn't really want to get into modifying the submit function.

Scott

Any progress on this?

Has there been any progress made on this?

Ubercart Tag

Re: Any progress on this?

This is actually a problem with the way Drupal handles multiple forms on a page. We can use your fix in the meantime.