Multiple forms with same id not compacted
opensanta - April 25, 2008 - 23:49
| Project: | Compact Forms |
| Version: | 5.x-1.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
I'm trying to use the CSS id "node-form" with more than one form on a page. Why does only the first form use the compact-forms features?

#1
Quote: I'm trying to use the CSS id "node-form"
Just guessing: because it's an id element, which is supposed to be unique in the whole HTML output. I guess the script stops looking for node-form as soon as it found the first occurance.
#2
I have 2 node add forms in blocks grouped in a Quick Tabs block. Here are the CSS id's I put in compact forms settings:
block-block-5
block-block-8
Unfortunately, only the first form gets compacted.
Is the block-block-"number" CSS id a viable way to get multiple node submission forms on the same page compacted?
#3
This may not help, or even makes sense, but I've been trying to hardcode the block id's into the module. Neither of these two attempts worked:
added these two lines under: function _compact_forms_include_js() {
$inline_js_block8 .= '$("#' . "block-block-8". '").compactForm(' . $stars . ', ' . $colons . ');';
drupal_add_js('$(document).ready(function() {'. $inline_js_block8 . '});', 'inline');
adding multiple id's in place of variable_get in:
$ids = explode("\n", variable_get('compact_forms_ids', "user-login-form"));
#4
I'm not familiar with Quick Tabs, but I think it is strange that the form id is in both cases block-block-X. Normally the form id is independent from the placeholder, in this case a block. But of course it is possible that this module does it it own way by design and alters the form id (but I don't really believe this to be honest).
Could it be possible to copy the whole block output? From both blocks?
Second, you may also want to try the FireBug console and trigger the javascript functions from there instead of hard coding anything. Makes it easier to see whether there are js errors involved.
#5
This should be fixed in the latest version.
#6
Please test attached patch.
#7
Thanks for reporting, reviewing, and testing! Committed to all branches.
A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.
#8
Automatically closed -- issue fixed for 2 weeks with no activity.