I am in need of some advice for how to use tables and the forms API together. I am building a module that will achieve grid pricing for products. Products are a certain price per product for 1-100 products, and a certain price per product for 101-200 product, and a certain price per product for 201-300, etc.

For the administrative UI when adding products, what seems most logical to me is something similar to an excel spreadsheet. Thus, I was thinking the most straight forward thing would be create a table and then put input fields within each of the table cells. Of course, I want to use the forms API, and that's where things get complicated.

Does anyone have any suggestions? Thanks in advance.

Comments

cghobbs’s picture

Ok, one alternative I have found is to use the prefix and suffix attributes of an element to specify the table tags. It requires a bit of extra logic to figure out where to start and end rows, but seems to work. However, I doubt this is the best practice, and I am wondering if any one as input on how to best do this.

--
Drupal Web Development by ImageX Media