Hi! I have some template which gets populated based on some function, but 
the latter gets an argument from javascript code, defined in the same 
template. Of course, it doesn't work, as js code doesn't get executed 
within the template context. Code is as follows:

<script>
    function getMonth() {
        return $("#month").find(":selected").text();
    }
</script>
<div class="main">
    <form method="post" name="user" id="user" action="/report">
        <div>
            <label for="month">Month</label>
            <select name="month" id="month">
            {{range .Months}}
                <option>{{.Name}}</option>
            {{end}}
            </select>
        </div>
    </form>

    <table style="border: 1px">
        <tr>
            <th>Week</th>
            <th>Max users</th>
        </tr>
{{range $week, $num := .Report getMonth()}} //This doesn't work
        <tr>
            <td>{{$week}}</td>
            <td>{{$num}}</td>
        </tr>
{{end}}
    </table>
</div>


Could anyone please suggest, how to resolve this thing?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to