Reputation: 7734
I have a form with a button which submit a form and open the page in a new window, my requirement is to get rid of this button in the page and add that into a menu navigation which make up of "<a><ul><li>
" tags,
so i am wondering how do i send these same data with a HTML link (must be send as a post as its a form submitted with the post method) following is the form coding
<form action="{url_main_only}:9090/login.jsp" name="loginForm" method="post" target="_blank">
<input type="hidden" name="url" value="/index.jsp">
<input type="hidden" name="login" value="true">
<input type="hidden" name="username" size="15" maxlength="50" id="u01" value="1">
<input type="hidden" name="password" size="15" maxlength="50" id="p01" value="{id}">
<input type="submit" value=" Login Openfire Administrative">
</form>
AND may main menu HTML CODE is generated as follows
<ul>
<li>
<a href="{url}">
<img src="{url_tmpl_admin}img/user.png"> Login to Openfire </a>
</li>
.....
</ul>
any easy way of doing this ?
Upvotes: 0
Views: 2414
Reputation: 3903
Give the form an id:
<form id="loginform" method="POST" action="...">
...
</form>
Then in your button, invoke the POST:
<a onclick="document.getElementById('loginform').submit();">Login to Openfire</a>
Upvotes: 1