Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I have an input button in my html page. I want to link the button to another html page with thymeleaf. This is my code.
<form id="hotDealForm" th:action="@{/hot-deal-step-1}">
<div class="col-xs-12 col-sm-6 col-md-6">
This Hot deal
<input type="button" value="Continue to schedule" class="btn btn-red"/>
</form>
My controller works fine. (I'm working with spring mvc). But I can't figure out what the problem is. I can do the same task using html. But when I am using thymeleaf its not working. That is when I clicked the button nothing happens.
There are many ways you can do but what I find the easiest is give a button class to a link as in following example. Since this class is a bootstrap's class so you need to have reference to bootstrap.
Since you are using MVC it already got Bootstrap linked.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<a href="@Url.Action("Index")" class="btn btn-success"> <i class="fa fa-arrow-circle-o-left"></i> Back to List</a>
public ApplicationUserManager UserManager
return RedirectToAction("Index","Dashboard",new{area="Admin"})
Adding the method as 'post' fixed the issue
<form id = "hotDealForm" th:action = "@{/hot-deal-step-1}" method="post">
<div class="col-xs-12 col-sm-6 col-md-6">
This Hot deal
<input type="button" value="Continue to schedule" class="btn btn-red" />
</form>
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.