Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.x-dev
Component:
exposed filters
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Feb 2009 at 16:28 UTC
Updated:
9 Jul 2009 at 22:10 UTC
Jump to comment: Most recent file
Comments
Comment #1
merlinofchaos commentedNote: form IDs are automatically assigned by FAPI.
Comment #2
netbear commentedYes, I know about form id.
I'm talking about button id, not the id of the form. The button has id "edit-submit" for every exposed form on my page. It would be better if it had id "edit-submit-MY_VIEW_NAME" and class "edit-submit".
Comment #3
merlinofchaos commentedYes, IDs of all form widgets are included as form IDs.
Comment #4
mp commentedhi merlinofchaos
is this fixed in the last version?
greets
Comment #5
danepowell commentedI'm still seeing this in 6.x-2.5. In fact you don't even need more than one filter on the page - just having a single filter conflicts with other Drupal elements such as the site search submit button.
Comment #6
danepowell commentedI know what is causing the error - form_clean_id is being used to generate the button ids (as alluded to in #1), but the form id cache is being flushed in includes\form.inc on line 182 -
form_clean_id(NULL, TRUE);. When I comment that line out, everything works fine. Supposedly that's there to prevent the id count from "needlessly incrementing." Personally I don't see why that's a problem, compared to completely defeating the purpose of using form_clean_id and producing invalid output.Comment #7
JirkaRybka commentedThat flush was added to fix another issue, where the same forms are built twice on the same page (on previews, I seem to remember - correct me if I'm wrong), making all the IDs (even unique ones) out-of-sync. They said it was a problem for JavaScript or the like. Certainly, the auto-generated ID's stuff is not really foolproof, yet.
Previously, I was just passing unique ID into the '#id' property of the button on my site (#2 have a good idea about 'edit-submit-MY_VIEW_NAME'), but the 6.x FAPI reference seems to mark '#id' as only INTERNAL, so I'm unsure whether it's going to work on 6.x or not. If it works, providing own unique ID might be a good idea.
Comment #8
danepowell commentedI think I understand why the flush was added, I just don't understand how it's a problem. Was incrementing the IDs actually breaking something, or was it just not ideal?
Comment #9
merlinofchaos commentedYes, if javascript thinks the ID will be edit-submit and Drupal changes it to edit-submit-1 that breaks stuff.
Comment #10
danepowell commentedOkay, in that case I agree that something along the lines of #2 sounds best. It seems like that should be a pretty foolproof solution.
Comment #11
JirkaRybka commentedSo, patch per #2: Changes the exposed filters submit button ID from duplicates of 'edit-submit' to 'edit-submit-VIEW-NAME'.
(There's already a class 'form-submit', in case someone needs such a thing.) And BTW, I have the problem on my (not finished yet) site too - ID is duplicate to the search box submit.
Comment #12
danepowell commentedThe patch solves the problem on my site. My only two concerns are
If anyone else can answer those questions I think this patch looks good.
Comment #13
JirkaRybka commented1. It shouldn't affect anything, as we're only just defining own ID on this single button - or is there some JavaScript attached to this very button already? (It would be beroken already, as the same ID appears elsewhere on the page too.) Certainly it won't cause the mentioned issues, where JavaScript was broken due to unexpected/dynamic change to all ID's on a page - we don't affect anything beyond the single button.
2. I guess that just relying on form_clean_id() should be sufficient. I'm not aware of any problems with ID's having uppercase characters.
Comment #14
danepowell commentedComment #15
merlinofchaos commentedCommitted to 2.x and 3.x branches.