Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vincej's avatar
Level 15

@clmrie

Thanks for coming back ! btw - I spent half my life living inthe UK.

I'm not entirely sure I follow. In L5 I am using http://laravelcollective.com/docs/5.0/html#opening-a-form.

Moreover if I look at the source which my current code generates, I get an id field and a value field. I just don't know who to populate it. The value field is being created simply by having an empty string in this code:

 <div class=" form-group">
       <div class="col-sm-2 col-sm-offset-8 col-md-2 col-md-offset-6">{!! Form::label('total', 'Total:') !!}</div>
        <div class="col-sm-4 col-md-4">{!! Form::text('total', '     ', ['class'=>'form-control ']) !!}</div>
</div>

The resulting source looks like this:

div class=" form-group">
                         <div class="col-sm-2 col-sm-offset-8 col-md-2 col-md-offset-6"><label for="total">Total:</label></div>
                         <div class="col-sm-4 col-md-4"><input class="form-control " name="total" type="text" value="" id="total"></div>
                     </div>

When I look at my JQuery script I am already trying to print into the unique fields with the #subtotal, #gst, #total. But I get nothing out when using the L5 Form::text ();

However when I use the simple html it outputs fine. Trouble is I need to grab those output when the user hits submit. This works and delivers the Jquery output:

  <p>Subtotal =<span id="subtotal" style="padding:0 10px;"></span></p>

By way of reminder here was the JQuery script:

 $(document).ready(function () {
            $('#textboxone, #textboxtwo, #textboxthree').on({
                blur: function () {
                    var a = $("#textboxone").val();
                    var b = $("#textboxtwo").val();
                    var c = $("#textboxthree").val();
                    var d = addnumbers(a, b, c);
                    var e = addGst(d);
                    var f = total(d, e);
                    $("#subtotal").html(d);
                    $("#gst").html(e);
                    $("#total").html(f);
                }
            });
        });

vincej's avatar
Level 15

@jimmck Nope - my DB mode does not account for them yet ... but that is the least of my concerns just right now. Getting the product of the Jquery script into the value field on the input is what I need.

thanks though for the reminder.

vincej's avatar
Level 15

@jimmck @clmrie @Snapey

Halleluyah !!! The last last piece of the puzzle and the whole thing is now working !

Essentially, getting your Jquery output into the value field of a Laravel 5 form::text() required an alternation to my script, replacing $("#subtotal").html(d); with $("#subtotal").val(d);.

All I have to do now is get the values into the DB - tomorrow's job.

thanks again for helping out !!

1 like
loqman's avatar
Answer You :
insert into blade template ->like this
@section('jq')
@parent
<script src="{{asset('project-mine/js/jquery-2.1.4.min.js')}}"></script>
<script >

    $(document).ready(function(){

        if ($(".scro-wind").width()<=750.5) {
            $(this).scrollTop(558);

        }


    });

 </script>
@endsection
1 like
Snapey's avatar

@loqman please check the posts date before replying. you just added to a 3 year old thread(and did not add anything not already said)

brainlet's avatar

window.someFunction= function() { // code };

// OR ES6 window.someFunction= () => { // code };

Snapey's avatar

@brainlet please check the posts date before replying. you just pointlessly added to a 4 year old thread

Previous

Please or to participate in this conversation.