disabled fieldsest

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

disabled fieldsest

redfox26
hi

i use spring boot with thymeleaf.

In my controller I done


    model.addAttribute("fieldDisabled", "disabled");

In my html field

   <fieldset form="myForm" th:attr="disabled=${fieldDisabled}">

Thymeleaf generate
   
   <fieldset form="myForm">

Any idea?

thanks
Reply | Threaded
Open this post in threaded view
|

Re: disabled fieldsest

Reiju
u can try th:disabled=""
Reply | Threaded
Open this post in threaded view
|

Re: disabled fieldsest

redfox26
not working
Reply | Threaded
Open this post in threaded view
|

Re: disabled fieldsest

Reiju
1. Add attribute to model
@GetMapping("/test")
public String test(Model model) {
        model.addAttribute("fieldDisabled", "disabled");
        return "test";
}


2. View page
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <fieldset th:disabled="${fieldDisabled}">
        <button type="button">Test0</button>
        <input type="text"/>
    </fieldset>
    <fieldset th:attr="disabled=${fieldDisabled}">
        <button type="button">Test1</button>
        <input type="text"/>
    </fieldset>
    <fieldset th:attrappend="disabled=${fieldDisabled}">
        <button type="button">Test2</button>
        <input type="text"/>
    </fieldset>
    <fieldset>
        <button type="button">Test3</button>
        <input type="text"/>
    </fieldset>
</div>
</body>
</html>

3. ???

4. PROFIT