Support the ongoing development of Laravel.io →
Database Forms Validation
Last updated 2 years ago.
0

You're on the right track with multiple tables/models. Also, jQuery may be your best friend.

On the back end:

I'd look into draggable, droppable, and sortable with predefined fields and use something like data attributes to set the value to hidden attributes.

As far as validation, maybe include a boolean in your table (and if statements in your views) and the required_with rule.

On the front end:

I've found with conditional forms, its better to build to entire form on the page and hide the conditionals with JavaScript once completed. I'd use something like jQuery to handle toggling the disabled attribute to not include the fields in the POST data and show/hide based on select options.

Last updated 9 years ago.
0

Hey dawiyo, thanks for the reply.

Yes good point with the required_with rule that will definitely come in handy, and as far as the frontend I was considering angular or something, though I am considering grouping the questions into 'steps' which would each be a separate request so I could show and hide steps via the backend (if that makes sense)

I'm more stuck on the best way to handle actual validation in the backend the 'laravel way' so for validating the fields that are created on the fly.

0

It's kinda hacky but you could use array names on the form fields to group by validation rules.

name="required[last_name]"

name="image[file1]"

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

SuperSeb92 superseb92 Joined 22 Dec 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.