0

I'm really struggling with EE. I am trying to build an application that needs to build a complex form based on channel data and the user's location.

The current stuggle is this:

It's a multi-page form, with lots of logic happening, depending on the choices the user makes, etc. At the end, I need to store the information somewhere, ideally in an EE channel, but at this point I'm not tied to that.

Normally, I could build this in straight php no problem, passing data from step A to the form in Step B, doing the logic, etc.

Is this something that needs to be done via a module? I see you can have forms post there and process data that way. Not sure in the end if I can get it into a channel, but maybe in my own custom table.

Is building a custom module the way to go?

-Jim

2

3 Answers 3

1

Use Channel Forms: https://ellislab.com/expressionengine/user-guide/add-ons/channel/channel_form/index.html

The easiest way to do multi-page forms is using javascript to just show / hide the next form section in the wizard when you click next / previous (and then submit on the final step).

1

Your suggestion of building it in straight php is still a perfectly acceptable and valid option. A few php-enabled templates with forms posting to themselves, validating and redirecting to the next step with already entered data in the session (just as you would normally in php) is sometimes how you have to go if the logic gets too complex. Then at the end you can create a channel entry using php (and even use EE's code to do so). Or just store it in a table depending on your needs. Good luck!

0

If you dont want to introduce PHP you can use one of the few plugins/modules to get you posted data. I've used Stash to do this in previous multi-step forms.

Simply like this:

 <form method="post" action="/{segment_1}/detail">
  <select name="state">
    <option value="state1">State1</option>
    <option value="state12">State12</option>
  </select>
</form>

Then on the 'detail' template, I can use:

{exp:stash:get name="state" dynamic="yes"} 

Obviously if you're going to save all this to a channel form, a single form with each "step" turned on/off via JS is a simple way to achieve it and negates the use of modules or complex work-arounds.

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.