Answers.Body: <p>I don't see any evidence that that field was ever used for anything. If you want to insert javascript into the page see <a href="https://docs.civicrm.org/dev/en/latest/framework/resources/#javascript" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/framework/resources/#javascript</a> which you can use as part of an extension: <a href="https://docs.civicrm.org/dev/en/latest/extensions/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/extensions/</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-05-13T08:50:36.057Z
Answers.Text: 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.
Answers.UserDisplayName: dading84
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-05-12T14:00:36.423Z
Answers.LastActivityDate: 2021-05-12T14:00:36.423Z
Answers.UserDisplayName: Demerit
Body: <p>I have noticed that there is a field called 'javascript' in the 'price_sets' table in the CiviCRM database.</p>
  <p>The comments associated with this field are:<br />
  'Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional'.</p>
  <p>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.</p>
  <p>I would really like to use this functionality, to limit what people can enter into a form, e.g. for event registration.<br />
  I know that this is not a fail safe method, but could limit confusion or mistakes from users.</p>
  <p>Does anyone have experience of using this database field to add javascript functions to? An example would be great!</p>
  
Tags: <price-sets><javascript>
Title: How do I use the javascript field in the price_sets table of the database
ThreadText: # How do I use the javascript field in the price_sets table of the database
  
  (Asked by: username_0 on 2021-05-12)
  
  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!
  
  **Tags:** price-sets, javascript
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-05-12. Score: 2 | Accepted answer
  
  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/>
  
  > **Comments:**
  > **username_0**: Thank you @username_1, 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.  
  
  ---
  
  