Basically what I am trying to accomplish is dependent attributes in the store page. Meaning when someone chooses one option, a later option becomes available/unavailable. This is a must for the site but apparently there exists no module to accomplish this for drupal 7.x.
So I decided that I would write some javascript in the document.ready function to add event attributes to specific select statements and buttons. (Like onselect and onclick). But to my surprise when I tried this, after the changes made by the javascript are appended, the code is overwritten back to its original state.
I assume this is happening because there is some code being run after my changes are applied that customizes the form elements to ubercarts default.
So my question is; is there a way to run my code after ubercarts? I tried searching for a solution to this but could not find one. Also while I am asking is there an easier way to have dependent attributes that I am somehow missing?
Comments
Comment #1
tr commentedComment #2
longwaveI just answered something very similar in #1990300: Trying to theme attributes with jQuery - you need to read up on how Drupal manages JavaScript, especially around Ajax calls, see http://drupal.org/node/756722#behaviors (and other sections on that page)
You may also be able to set up dependent attributes entirely server-side using the Ajax functionality provided by the "Update product display based on customer selections" feature.
Comment #3
end user commentedWill this module be of use http://drupal.org/project/conditional_fields
Comment #4
sittard commentedPerhaps this module might help:
http://drupal.org/project/uc_dropdown_attributes
Comment #5
BField commentedThank you! This fits what I need perfectly!