millions-morning-77621
06/22/2021, 7:36 AMmillions-morning-77621
06/22/2021, 7:36 AMmillions-apartment-38225
06/22/2021, 10:18 AMhtml
<div hx-get='edit.php' hx-vals='{"id":"classIdHere"}'>Edit</div>
The edit.php file is where you output your modal contents. This has all markup for the forms and then you use the id to get the correct data from your db, to prefill the input fields with.
Wrap whatever you are outputting in edit.php with
xml
<div id='idOfYourModal' hx-swap-oob='true'></div>
This will output the prefilled form into the specified element on the page that triggered the htmx request. So on your index you would have a (presumably hidden) element named idOfYourModal that receives the output.
Finally you can use something like this on your index page, to reveal your modal after htmx has filled it with the form.
javascript
htmx.on('htmx:afterSwap', function(event) {
if (event.detail.target.id == 'idOfYourModal') {
//Code to reveal your modal here
}
});
This should give you a reusable modal that loads whatever content you want to edit.millions-morning-77621
06/22/2021, 10:22 AMmillions-apartment-38225
06/22/2021, 10:28 AMhttps://i.imgur.com/SlfQtm4.png▾
little-greece-16394
06/22/2021, 10:31 AMxml instead. Here's the list of supported languages: https://github.com/highlightjs/highlight.js/tree/main/src/languagesmillions-apartment-38225
06/22/2021, 10:33 AMlittle-greece-16394
06/22/2021, 10:33 AMlittle-greece-16394
06/22/2021, 10:33 AMmillions-apartment-38225
06/22/2021, 10:41 AMhtml. Learned that adding a space after the language you want to highlight, makes the whole thing stop working so that's where I messed up earlier.little-greece-16394
06/22/2021, 10:41 AMmillions-morning-77621
06/22/2021, 11:17 AMmysterious-toddler-20573
06/22/2021, 2:01 PMmagnificent-scientist-63990
06/22/2021, 2:49 PM<div ic-get-from="/System/Content/index.aspx?id=<%=HttpContext.Current.PageParameters().Node %>&embed=true" ic-trigger-on="load" ic-enhance="true">magnificent-scientist-63990
06/22/2021, 2:50 PM`<div hx-get="/System/Content/index.aspx?id=<%=HttpContext.Current.PageParameters().Node %>&embed=true" hx-trigger="load" hx-boost="true"> This would decorate the form with ic-src, ic-trigger-on, ic-verb, etc .. but setting hx-boost does not seem to do this anymore. Am I doing something wrong?magnificent-scientist-63990
06/22/2021, 3:09 PM<form method="post" action="https://xxxx.be/System/Content/index.aspx?id=323342&embed=true&ic-request=true&&ic-id=1&ic-current-url=%2FSystem%2FMenu%2FIndex.aspx%3Fid%3D323342&_method=GET" id="form1" class="d-flex flex-column h-100" ic-src="https://xxxx.be/System/Content/index.aspx?id=323342&embed=true&ic-request=true&&ic-id=1&ic-current-url=%2FSystem%2FMenu%2FIndex.aspx%3Fid%3D323342&_method=GET" ic-trigger-on="default" ic-deps="ignore" ic-verb="post" ic-id="4">mysterious-toddler-20573
06/22/2021, 3:18 PMmysterious-toddler-20573
06/22/2021, 3:18 PMmagnificent-scientist-63990
06/22/2021, 3:19 PM<form method="post" action="https://localhost:44394/System/Content/index.aspx?id=323342&embed=true" id="form1" class="d-flex flex-column h-100">mysterious-toddler-20573
06/22/2021, 3:20 PMmysterious-toddler-20573
06/22/2021, 3:20 PMmysterious-toddler-20573
06/22/2021, 3:21 PMmysterious-toddler-20573
06/22/2021, 3:21 PMmysterious-toddler-20573
06/22/2021, 3:21 PMmagnificent-scientist-63990
06/22/2021, 3:22 PMmysterious-toddler-20573
06/22/2021, 3:22 PMmagnificent-scientist-63990
06/22/2021, 3:23 PMmagnificent-scientist-63990
06/22/2021, 3:24 PMmysterious-toddler-20573
06/22/2021, 3:26 PMmysterious-toddler-20573
06/22/2021, 3:27 PM