1

I need some help modifying the Webform Module so that it can work for my project. I use Webform right now for single page, basic forms, and it works wonderfully. What I need to be able to take multiple webforms and string them together based on some initial selections a user makes. Let me give an example.

The user is sent to a "General Information" webform, where they put in things like name and birthday. There are also 3 questions with check-boxes which are:

"Do you have a house"

"Do you have a car"

"Do you have children"

The user can select all, some, or none of the options. Based on what the user selects, once they press the submit button, they will be sent to the "House form", "Car form", and/or "Children form".

When they're done filling out all the forms, an email is sent to the admin just like webforms does now. The information does not need to be stored on the website in the database, the email is sufficient.

So, any suggestions on how to do this? Would something else besides Webform be more appropriate? Or (if I'm super lucky) does a module which does what I need already exist?

3 Answers 3

1

Why not simply show, or hide, the form elements as required, rather than redirect to other, potentially-multiple subsequent, forms?

Using the following (x)html:

<form enctype="form/multipart" method="post" action="">

    <fieldset>

        <legend>Cars:</legend>

        <label for="cars">Do you have one, or more, cars?</label><input name="cars" id="cars" class="test" type="checkbox" />
        <fieldset class="subSection" id="cars">
            <input type="radio" name="numCars" value="1" />One
            <input type="radio" name="numCars" value="2" />Two
            <input type="radio" name="numCars" value="3" />Three
        </fieldset>

    </fieldset>

    <fieldset>

        <legend>Children:</legend>

        <label for="kids">Do you have one, or more, children</label><input name="kids" id="kids" class="test" type="checkbox" />
        <fieldset class="subSection" id="kids">
            <input type="radio" name="numKids" value="1" />One
            <input type="radio" name="numKids" value="2" />Two
            <input type="radio" name="numKids" value="3" />Three
        </fieldset>

    </fieldset>

    <fieldset>

        <legend>Houses:</legend>

        <label for="houses">Do you have one, or more, houses</label><input name="houses" id="houses" class="test" type="checkbox" />
        <fieldset class="subSection" id="houses">
            <input type="radio" name="numHouses" value="1" />One
            <input type="radio" name="numHouses" value="2" />Two
            <input type="radio" name="numHouses" value="3" />Three
        </fieldset>

    </fieldset>

</form>

And the jQuery (which could be tidied, but I'm still new at it myself...so 'proof of concept' only, I'm afraid):

$(document).ready(
    function() {
        // hide the sub-sections
        $('fieldset.subSection').hide();

        // show subsections onClick of the .test checkboxes
        $('input.test').click(
            function() {
                $(this).next('fieldset.subSection').slideToggle('slow');
            }
        )
    }
);

Live demo currently located at: http://davidrhysthomas.co.uk/so/subForms.html

Sign up to request clarification or add additional context in comments.

3 Comments

Incredible, thank you. The forms that are to be filled in however are really large, and placing all that information on one page would be incredibly daunting for the user. Again, thank you though. I've never gotten an answer WITH live demo.
I can only speak from experience, but I've never enjoyed having to move from page-to-page to fill in one form. It's worth looking into javascript implementations, to break one monolithic form into smaller sections or 'pages' on a carousel-like interface.
@Davey, thank you. But it's fairly basic jQuery. I heartily recommend, if you like this, visiting docs.jquery.com and reading around the subject there. =)
0

Conditional fields are a feature of the upcoming Webform version 3. See the related issue and the beta version that was released two weeks ago.

1 Comment

Thanks for pointing this out. I hadn't seen the beta, but it does everything I need.
0

Create custom module, that will catch submit via hook_nodeapi and redirect to proper form or page...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.