2

I am building a D7 website and I want the following feature for the site admin, regarding the Webform module:

When the admin creates a webform, the admin uploads a submit-image and this image is used as the submit button for the webform. so if he uploads a "click-me.png" I want the path to this image to be used in the input[type=image] class="form-submit" src="/path to uploaded image"

Is there a simple way to achieve this, or do I have to seperately hardcode the behaviour I want for each webform?

P.S. By default webform's submit button is of type "text" and not "image", but I easily managed to change this using this excellent solution.

1 Answer 1

1

The easiest way to do this would be to write your own module. The place to start looking would be here: http://drupalcontrib.org/api/drupal/contributions!webform!webform.api.php/function/hook_webform_component_info_alter/7

2
  • what you propose is reasonable although in drupal there are so many modules and ways to achieve a goal that I wouldn't be surprised if I am missing sth ready or almost-ready for my case. May 31, 2013 at 15:27
  • I'd say your case is pretty unique. I don't think you'll be able to find an out-of-the box solution unfortunately. This is probably pretty simple to achieve. I would include an upload field on your image, then it would probably be only a few lines of code from the webform API to tell it to use that image as the button image vs. the default. If you never made your own module, look here: drupal.org/node/1074360. One of things that makes Drupal great is it's "hook" based API system. Meaning it's pretty easy to alter default behavior like this and not need a ton of programming experience. Jun 1, 2013 at 3:39

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.