lundi 7 mai 2018

Send two values from table when a checkbox is clicked (checked) in Freemarker Template Language

        <#if userDatas?? >
            <form action="remove-list" method="POST" autocomplete="on" class="form-horizontal" role="form" id="form1">
                <table class="table table-bordered table-striped">
                <thead>
                <tr>
                    <th class="minwidth">select All <input type="checkbox" onchange="checkAll(this)"> </th>
                    <th>roll no</th>
                    <th>name</th>
                    <th>Created date</th>
                    <th>modified date</th>
                </tr>
                </thead>
                <tbody>
                    <#list userDatas as userData>
                    <tr>
                        <td class="centered-simple"><input type="checkbox" name="entries" value="${userData.roll}" id="${userData.roll}" ></td>
                        <td>${(userData.roll)!notset}</td>
                        <td>${(userData.name)!notset}</td>
                        <td>${(userData.whenCreated?datetime)!notset}</td>
                        <td><code>${(userData.whenModified?datetime)!notset}</code></td>
                    </tr>
                    </#list>
                </tbody>
                </table>
                <div class="btn-group btn-group-tss">
                    <button type="submit" class="btn btn-primary">
                        <span class="glyphicon glyphicon-search"></span> Delete selected 
                    </button>
                </div>
            </form>
        </#if>

In the above code snippet, I have a table with the heading select all, role, name, created date and modified date.

When I click the Delete selected button, obviously userdata.roll value will be sent.

Here I want to send both userdata.roll and userdata.name when a checkbox is clicked.

I tried but couldn't get success.

Please help me how I can send both the values when a checkbox is checked.

PS : I'm using FTL to code.




Aucun commentaire:

Enregistrer un commentaire