Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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.

In reply to Re: Catalyst client to server interaction by tangent
in thread Catalyst client to server interaction by QuillMeantTen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (1)
As of 2023-09-28 21:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?