문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top