[luci] How to call and pass arguments to lua function from a *template*

Le Tran Dat trandatnh at gmail.com
Thu Dec 12 01:30:12 CET 2013


Hi all,

I wonder if I could call and pass arguments to a lua function which
located in the firmware. What I am trying to archive is the same with
clicking button delete in tblsection.htm template.

Here is the onlick event of delete button in template tblsection.htm:

onclick="<% luci.sys.call("env -i chilli_query logoff mac") %>
this.form.cbi_state='del-section'; return true"

I observed I could run a lua command right before calling del-section.
However, what I am trying to do is pass an argument into the lua
command right before clicking delete button.

Here is my situation, I have a table included:
Mac Addr(DummyValue) - IP Addr(DummyValue) - Other Option(DummyValue) - <Delete>

What I want to achieve is whenever I click the button <Delete> then I
get the value of Mac Addr or IP Addr and pass it through a lua
function to print it into the firmware(OpenWRT).

Currently, I can be able to get the Mac Addr and IP Addr by using
javascript within a template. However, I have no idea how to pass the
Mac Addr to lua funtion.

I hope I explained my case well so you can understand what I am talking about.

Thanks,
Dat


More information about the luci mailing list