Linked Questions

0
votes
1answer
45 views

Problems with altering a form [duplicate]

I'm wanting to alter the commerce cart page form. By using var_dump($form_id) or chrome inspect I can see the id is id="views-form-commerce-cart-form-orange-default-42". If I write my hook as : ...
39
votes
3answers
60k views

Adding CSS and JS to form with attachments

I need to add some external and local CSS and JavaScript files to a form, but I can't seem to find the right way to do this. Do I simply add the paths and URLs for the JS and CSS files? I assume $...
5
votes
4answers
6k views

How do you identify a form element?

I'm still learning Drupal, and I was trying to use hook_form_alter() to resize a text field added from a module. My problem is that I don't think I'm indentifying the element correctly. Here's the ...
1
vote
2answers
782 views

Use CAPTCHA module on a custom HTML form? (no use of Drupal Form API)

Is it possible to use the CAPTCHA module on a custom HTML form created in a content page of a Drupal 7 site? I am not using the Drupal Form API or webform modules. The form has the following code: ...
0
votes
1answer
856 views

Using ajax in my entityform

I have a content type called Area and another content type called apartment that has a reference to area. I have an Investment form (using entityform module) in which users select which area; after ...
1
vote
1answer
303 views

Is there a way to alter output/markup for a field in node edit view?

I am looking for a way to alter field output when rendered in the normal edit view. I have looked at the hook_quickedit_render_field function which helps out in quick edit mode but are there ...
2
votes
1answer
86 views

Can't add js to content creation pages

I'm trying to add JS to content create pages using the second function from @kiamlaluno's answer However, this is not working for me. I created a module with his folder structure: add_js add_js....
0
votes
1answer
127 views

When creating a module, where do I set cookies?

Drupal 7 newb here. I am creating a simple module. Basically, this has an admin config form with a message text area. On the front end, that message appears or not depending on the state of a cookie. ...
1
vote
2answers
62 views

how to add posting options to content types?

I'm porting a Drupal 6 module to Drupal 7. In Drupal 5 & Drupal 6, there was a Workflow section in the Content Types area and the additional fields went there. This is gone in Drupal 7. I tried to ...
1
vote
1answer
34 views

Dynamically add User into a role

I have set up a Drupal site to connect to an external payment gateway (not using Drupal Commerce) for subscription-based billing. So making use of Drupal Webform, I have created forms for users to ...
0
votes
2answers
30 views

Is there a way to reduce or block webform submissions with foreign (non-English) content?

On Drupal 8/9 we have webforms that have been getting 5-20 spam/bot emails per day with foreign languages (looks like it may be Rusian). We have Honeypot, reCaptcha 2/3, Antibot, and Cloudflare setup ...