3

For instance, if my price field is called Main Conference (Before 7/31), the CSS class it gets is: "main_conference_before_7_31_-content"

If I change the title of the price set, the CSS class changes.

When modifying the form with jQuery, we rely on the CSS class to make adjustments like .prependTo (etc.). Perhaps this is not the most ideal way to do it, but it's worked in a pinch.

How difficult would it be to make an extension to make the price set field class fixed, or even user-adjustable? Or, to set a class and ID for each one?

Civi 4.7 or 5.x

2 Answers 2

1

CiviCRM uses civicrm_price_set.name to generate class. I believe this field in never updated on Update mode. It is updated when we explicitly set them using api or mysql query.

1
  • I tested it on 5.6.alpha1 and it does not change now.
    – Zachary
    Commented Aug 4, 2018 at 18:23
1

I'm not sure how much the price fields name will change but perhaps you can use some 'wildcard' attribute selectors? (contains, starts with etc.)

http://api.jquery.com/category/selectors/attribute-selectors/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.