Hello,
I am developing a module a little module using a custom field that would allow users to vote (using votingapi) on product entities (not product display).
I am using a custom field that displays several social voting widget (a custom one - just a form image_button, facebook, google+1) and everytime somebody clicks on one of these links, i add a vote to the product being displayed.
The custom field module just displays the widgets, and a .js file catches the events, then fires ajax calls (jquery.ajax()) to cast the votes in my php ajax_function_callback().
Everything works fine if i load the first product of the page (which is actually automatically loaded when i get on the page), ajax works fine ! However, when I load the other product from my product display using the add_to_cart form dropdown options, the new form gets generated with some problems when it comes to my voting field :
- The Facebook widget just don't show up (xfbml type)
- All the ajax calls direct me to system/ajax instead of ajax/vote menu_callback item (while it was correct before i loaded the 2nd product)
- When i click on my voting button (the image_button item) my .js file doesn't catch the event anymore it just gets redirected to "system/ajax"
- I checked in the code using firefox, and the new product form uses system/ajax as facebook link which are generated using a request_uri()
As I understand, the problem is that the form that have been loaded by the product reference add_to_cart was loaded by system/ajax, hence, all my request_uri became system/ajax rather than my product display uri - Also, my field formatters takes care of loading the JS and the FB widgets javascript (in the header), so maybe when the page is loaded a second time via add_to_cart form, there is a problem somewhere?
I THINK this is not directly related to Drupal Commerce module, but i'm a bit lost here - anybody tried to use ajax in his product display form ?
Some search result here that LOOKS like to point out my problem, but it seems to have been fixed a year ago ...
- #484838: [rfay version] AJAX form can submit inappropriately to system/ajax after failed validation
- #671184: AJAX form can submit inappropriately to system/ajax after failed validation
Please heeeeelp :-)
Comments
Comment #1
rfayWould it be possible for you to create a mini-module that just demonstrated this, so it could be debugged? I don't actually think this sounds like #671184: AJAX form can submit inappropriately to system/ajax after failed validation. It sounds like you've done something kind of "out of bounds" with AJAX forms perhaps....
Comment #2
rszrama commentedPretty old now; sounds like this was an error during form rebuilding - usually what gives me the system/ajax response. Oh well.