0

Greetings, can someone help me on this? I'm really out of ideas.

What i need to do is when i click the link the value of it's ID should be pass on the label inside the modal.

Here's my code:

<div class="row">
    <div class="large-12 columns">
        <label id="devFont">-Device-</label>
        <div class="row">
            @foreach ($deviceList as $devList)
            <div class="row">
                <div class="large-6 columns">
                    <label id="txtMargin">{{++$ctr, ".  ", $devList->device_name }}</label>
                </div>
                <div class="large-5 columns">

                    {{ link_to('', 'Assign', $attributes = array( 'id' => $devList->device_name, 'class' => 'button tiny large-0 radius', 'title' => 'Assign a device to a person', 'data-reveal-id' => 'assignModal', 'name' => 'assignDev')) }}

                    {{ link_to('', 'Edit', $attributes = array('class' => 'button tiny large-0 radius', 'title' => 'Edit a Device')) }}

                    {{ link_to('Item/delete/ '. $devList->id, 'Delete', $attributes = array('class' => 'button tiny large-0 radius', 'title' => 'Delete selected Device', 'id' => $devList->id)) }}

                </div>
            </div>
            @endforeach
        </div>
    </div>
</div>

And here's my code on my modal:

<div id="assignModal" class="reveal-modal small" data-reveal>

    {{ Form::open(array('url' => 'adddevice')) }}

    <div class="row">
        <div class="large-12 columns">
            <div class="large-9 columns">
                @foreach ($devName as $deviceN)
                {{ Form::label('device', $deviceN->device_name , array('id' => 'modalLbl')) }}
                @endforeach
            </br>

            </div>

            <div class="large-12 columns">

                {{ Form::label('', "Person's name", array('id'=>'Font')) }}

                {{ Form::text('personTb', '' , array('placeholder' => 'Enter Persons name')) }}

                {{ Form::label('', "Cubicle's Number", array('id'=>'Font')) }}

                {{ Form::text('cubicleTb', '' , array('placeholder' => 'Enter Cubicle Number')) }}

            </div>
        </div>

            <div class="large-12 columns">
                <div class="large-2 columns">
                    {{ Form::submit('Deploy' , $attributes = array('class' => 'button tiny small-0 radius', 'name' => 'submit')) }}
                </div>
            </div>
        </div>

        <a class="close-reveal-modal">&#215;</a>

    </div>

    {{ Form::close() }}

</div>

Thank you in advance.

1
Contributor
1
Reply
10
Views
2 Years
Discussion Span
Last Post by Jake.20
1

Solved in now! What i did is.

I change this

{{ link_to('', 'Assign', $attributes = array( 'id' => $devList->device_name, 'class' => 'button tiny large-0 radius', 'title' => 'Assign a device to a person', 'data-reveal-id' => 'assignModal', 'name' => 'assignDev')) }}

to this

{{ link_to('', 'Assign', array('onclick' => 'deviceProperty('. $devList->id .', "'. $devList->device_name .'")', 'data-reveal-id' => 'assignModal' , 'class' => 'button tiny large-0 radius' )) }}

and changed the label's name to this:

{{ Form::label('','', array('name' => 'labelDevice', 'id'=>'devLabel', 'class' => 'deviceLbl')) }}

and created a hidden field for the device's id:

{{ Form::hidden('', '', array('name' => 'idTb', 'id'=>'id_textbox')) }}

And i added a <script> to pass the values to the label

    <script>
    function deviceProperty(id, device_name) {
        document.getElementById("devLabel").innerHTML = device_name;
        document.getElementById("id_textbox").innerHTML = id;
    }
    </script>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.