I'm creating a collapsible fieldset on my home page and have put the following code in a block (structure > blocks):

<script type="text/javascript" src="/misc/form.js"></script> 
<script type="text/javascript" src="/misc/collapse.js"></script> 

    <fieldset class="collapsible form-wrapper">
        <span class="fieldset-legend">Legend</span>
      <div class="fieldset-wrapper">Content</div>

It actually works what I did using the 'Full HTML' text format. I did it this way though only because I don't know the preferred way.

I imagine this would normally be done (for security reasons or something...) by creating a module or via a preprocess function.

Am I wrong to second guess myself here? Maybe it's standard practice to do what I've done above.

Any guidance is appreciated. Thanks.


Form submit would not work unless you have an action for it.

You should rather do it in Drupal way, you will need following.

  1. Create Custom Module in drupal.

  2. Block API to create your custom block

  3. Forms API. to create a custom form and call it in your custom block.

Here goes a demo module which will help you understanding the API https://github.com/arpitr/demo_block_form

Installing the module will give you a block which will look like as

enter image description here

  • thanks for your response. The form is not actually used so I really don't need it. I just want a collapsible fieldset on the home page to make it less 'long'. That way people can expand an item to read it if they want to read it. – Sage Sep 12 '15 at 2:29

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.