Have I got this - when a user clicks on one of the list items a JS function is called to select that item, and if the user then clicks on the Delete button you call another JS function to delete the list item from the DOM, but you also need to actually delete the item on the server?
If correct, then what I would do is, instead of deleting the list item I would hide it or mark it in some way, and also give it a class - say 'for_delete'. Then when the delete button is clicked I would use JS to scan for any list items with the class 'for_delete', collect their ids and then send a request to the server either via an AJAX call or by appending the ids to the form and then submitting the form.
You could re-write your template something like:
[% FOREACH key IN services.keys -%]
<li onclick="select(this)" id="[% key %]" class="">service : [% ke
+y %] jours de repos: [%services.$key.nb_jours%] interieur : [%service
+s.$key.interieur%]</li>
[% END -%]
You will also need to give your form a name or an id so you can select it and append the ids.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|