-
Notifications
You must be signed in to change notification settings - Fork 61
Closed
Labels
BugSomething isn't workingSomething isn't working
Milestone
Description
Hi
I make use of triggers in HtmxResponse and wonder how this would be possible in 4.0.0 with HtmxResponse gone? Thanks in advance.
@HxRequest(boosted = false)
@PostMapping("")
public HtmxResponse hxSave(
@Valid
@ModelAttribute("address") AddressDto addressDto,
BindingResult result,
Model model
) {
if (result.hasErrors()) {
model.addAttribute("address", addressDto);
Iterable<Person> persons = personService.findAll();
model.addAttribute("persons", persons);
return HtmxResponse.builder()
.view("address/partial/dialogs :: form-dialog")
.build();
} else {
try {
Address address = addressService.save(addressDto);
model.addAttribute("success", address);
return HtmxResponse.builder()
.trigger("addressChanged")
.view("address/partial/dialogs :: form-dialog")
.view("fragments/message :: saved")
.build();
} catch (Exception ex) {
model.addAttribute("error", ex.getLocalizedMessage());
model.addAttribute("address", addressDto);
return HtmxResponse.builder()
.view("address/partial/dialogs :: form-dialog")
.build();
}
}
}Alwan
Metadata
Metadata
Assignees
Labels
BugSomething isn't workingSomething isn't working