2

I have a image field on profile content type. And when users try to save the content without uploading images I would like to show pop up confirmation message "Are you sure you want to save your profile without photos?" with "OK" button. And I need the content to be saved only after the users click the "OK" button.

I thought I could do this with Rules module however it look like there is no action for showing popup message with "OK" button of confirmation.

Is there any way to achieve this?

2 Answers 2

2

The custom way to do this would be to use hook_form_alter to add some jquery into the form you are targeting that would bind to the submit action of the form and execute some javascript function (ex. an alert) if a form field value is not filled out.

The key library for this is the jquery validation library here:

http://bassistance.de/jquery-plugins/jquery-plugin-validation/

There are also a couple modules you could try and install that implement this library and offer direct integration with your field through the form api. I've used this one:

http://drupal.org/project/clientside_validation

To achieve a similar validation effect as what you're looking for.

1

There is also a sandbox module to achieve this using rules + actions : https://www.drupal.org/sandbox/cmcintosh/2644004

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.