Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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 :

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

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?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (1)
As of 2023-09-28 21:46 GMT
Find Nodes?
    Voting Booth?

    No recent polls found