Greetings, fellow monks
To help the interns at my town hospital set up their shift calendars I wrote an openoffice base macro (in OObasic, bleh) after some time I rewrote it in java to make it portable, then when I thought about the hassle of having untrained user open a terminal and type "java -jar mything --xls input.xls" I decided to set it up as a web application.

There started a painful trip, unknowing of frameworks like sails I wrote it in nodejs (even though I hate javascript with a passion) and cobbled together a rag tag session system to prevent users from having to register themselves.
After falling in love with perl I decided to get rid of that crap and rewrite it in perl using Catalyst.

After some fiddling around I managed to setup a session system using cookies so the server can keep track of data added by users during their sessions, problem is I am now coding the ability to delete any data they have entered and I hit quite a roadblock : how do I do that?
Data is submitted to the server in the url using a GET request and the following scheme :

http://127.0.0.1:3000/serviceform?nom_service=service&nb_jours_repos=1

This is a get request to record data, now to delete it I whipped up some javascript code to make users able to point and click at whatever data they want to delete (data is displayed that way in the template : )

[% FOREACH key IN services.keys -%] <li onclick="select(this)">service : [%key%] jours de re +pos: [%services.$key.nb_jours%] interieur : [%services.$key.interieur%]</li> [% END -%]

Because I save everything in a hash of hashs inside my session.

here is the form used to enter data that is sent to the server and displayed on the webpage :

<form> <label for="ns">nom du service </label> <input type="text" name="nom_service" id="ns" value="s +ervice"/> <label for="nbjdr">nombre de jours de repos</label> <input type="number" id="nbjdr" name="nb_jours_repos" +value=1 /> <label for="int">service d'intérieur?</label> <input type="checkbox" id="int" name="interieur" /> <input type="submit" value="ajouter"/> <input type="button" class="remove" onclick="remove()" + value="supprimer"/> </form>

The remove function called is a javascript one to delete the li nodes with the selected class. I can set any of those list item class to selected but what should happen when I press the delete button, I need to delete those entries on the server as well, not just in the client browser. I think some kind of request should be in order but I haven't the foggiest about how it should be handled, maybe a special case of submit with a hidden delete boolean set to true..? If anyone cares to give me a hint about the best way to do it it would be most welcome.


In reply to 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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.