Support the ongoing development of Laravel.io →
Blade Forms
Last updated 1 year ago.
0

The only way to handle this without page reloading is to use some form of javascript like angular or jquery or something like that.

for page reload just check for it to be enabled/checked using something like this

@if( Input::get('material', false))
    ... show something here ...
@endif

with jquery you can use something like this keep in mind with this option you'll need to validate that the checkbox is checked in the backend before saving those values to the database.

<script>
    $(function(){
        //listen for checkbox clicked, works for check and uncheck
        $("#material").click(function(){
            //get if checked, which returns a boolean value
            var formElementVisible = $(this).is(":checked");

            //show if checked
            if ( formElementVisible ){
                $(".elementToShowOrHide").show( );
                return true;
            }

            //hide if unchecked
            $(".elementToShowOrHide").hide( );
            
        });

    });
</script>
Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.