how to add webform in the bootstrap modal window?

Hi,

Can some one help me to fix the below issue.

I am trying to add a webform in the bootstrap modal window. But the webform is not rendering. below is the code snippet.

function hook_bootstrap_modal_forms() {

0 13 1,229
13 REPLIES 13

Is your question related to the Apigee Edge developer portal ?

yes.. Apigee edge portal uses the bootstrap modal form module by default.

Hi @Anil Sagar, Can you please help me on this..

Can anyone help me here

Sorry you're having trouble.

I don't understand the question or the problem you're having. You wrote that you want to add a webform to the bootstrap modal window. Well, what bootstrap modal window? Isn't this a bootstrap question? Should you ask on a bootstrap forum?

I'm sorry you're having trouble. I suspect the other potential responders here are like me - none of us know how to help you with this question, as you have asked it.

The code snip you provide is... not enlightening. I think you need to provide more details in what you are doing and what specifically you want help on. Some context about what you're really trying to do.

Put yourself in the shoes of a reader. We know absolutely nothing about what you are looking at, what you are trying to accomplish, the obstacles you are facing, what you have tried, why you are doing what you're doing. You've got to give people a little more context, to give us a chance to understand the problem you are confronting.

Hi @Dino,

Apigee developer portal uses "bootstrap modal form" module.. You can see that in profiles/apigee/modules/contrib/ location.

My requirement is to show a webform (basically for feedback collection form) in a pop up window. When I am looking into this feature I saw this module as a part of apigee profile. So thought to use this. I can see the module provides the hook to add any form to the popup. This is the hook function that they mentioned

function hook_bootstrap_modal_forms() {

}

But when I am trying to use this, all the other forms are rendering perfectly fine in the popup except webforms. So need some advice here.

Hope you are clear now. Sorry for the communication gap.

Thanks,

Nikhil



Regarding the question "Isn't this a bootstrap question? Should you ask on a bootstrap forum?" I saw Anil and one other person who actively gave suggestions for any kind of apigee modules issue with in a day or 2. thats why I asked here..

Also not sure how apigee added a sandbox project to their profile as there many stable project readily available to achieve this type of features.

ok, now we're getting somewhere.

Maybe you know this, but: The hook_bootstrap_modal_forms allows you to modify a form. With this hook, you define a function with an appropriate name that can then modify a form that has been defined elsewhere, before the form appears. (The hook concept is used extensively in drupal. )

See here for a good example (from Anil!) on the use of this particular hook.

You cannot implement a new form by defining the hook. That's not how the bootstrap modal forms module works. That's not what it does. In fact what it does is add bootstrap magic to existing forms in the drupal system.

For help on defining a new form in drupal, I'll direct you to outside tutorials. You can then follow the pattern in the bootstrap_modal_forms module to add bootstrap modal capability to your form.

Good luck.

As for why there is a new sandbox module, I don't know the answer to that.

Hi @Dino,

Thanks for your reply..

I think still you are not clear.Let me explain you in another way. I already created a webform and I just want to show that in the popup.(In your words I just want that bootstrap magic in my existing webform).. Here is the complete code snippet

function mymodule_bootstrap_modal_forms() {

$items = array();

$node = node_load('144');

$form =drupal_get_form('webform_client_form_144', $node);

$items['feedback'] = array(

'form' => $form,

'title' => t('Feedback'),

'action' => 'content/feedback'

);

return $items;

}

Thanks,

Nikhil

Thanks for pasting the code. I don't know why you didn't paste that in the first place.

I'm not familiar with the forms generated by webform or if they will work nicely with the bootstrap modal forms module.

Sorry, this is new ground you're covering. I think you're on your own!

If it's just one simple feedback form, you can probably build it yourself without webform. If you do that, it will be easier to integrate with bootstrap_modal_forms.

Anyway good luck, Nikhil.

@Nikhil , See similar question asked here & accepted solution. Keep us posted if any.

Thanks Anil. I tried this and is working as expected. But I dont want to load another module as one is already there as part of core package.

Glad to know it works, It's all about either re-inventing the wheel with custom code / Using the Out of the box module. Core module we are using just to make it work with custom forms. I am sure above module i have mentioned also uses same ctools core module.

I don't think any reason you should not use it. Any way you will end up writing new custom module like the one i have mentioned above in the link. I would suggest to use the solution that worked for you and go ahead.

Great Questions, Keep us posted moving forward if any.