I have noticed that there is a field called 'javascript' in the 'price_sets' table in the CiviCRM database.

The comments associated with this field are:
'Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional'.

However I cannot find any documentation on how I should do this in the correct way, and have never seen it mentioned when using price sets through the UI.

I would really like to use this functionality, to limit what people can enter into a form, e.g. for event registration.
I know that this is not a fail safe method, but could limit confusion or mistakes from users.

Does anyone have experience of using this database field to add javascript functions to? An example would be great!

1 Answer 1


I don't see any evidence that that field was ever used for anything. If you want to insert javascript into the page see https://docs.civicrm.org/dev/en/latest/framework/resources/#javascript which you can use as part of an extension: https://docs.civicrm.org/dev/en/latest/extensions/

  • Thank you @Demerit, that's very useful. I haven't had a chance to work through that yet, there looks like there's quite is a bit to it, I'm still yet to create my first extension. I will see if anyone else can shed any light on that db field, else I'll mark your answer as accepted.
    – dading84
    Commented May 13, 2021 at 8:50

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.