I defined a variable in my .js file and want the user/client to change that as per his needs. Is it somehow possible to use that value in forms in drupal?


Too vague of a question, bring some examples of code.

It might go in a custom module (thus doing differently) or just using JavaScript where you can surely alter values of a variable.


Best practice is to store configuration in code, not in the database. With that said, the following will add an arbitrary JavaScript snippet:

drupal_add_js(variable_get('your_variable'), array(
  'type' => 'inline',
  'scope' => 'footer',

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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