ksublondie has asked for the wisdom of the Perl Monks concerning the following question:
I've determined that the parameters are using the name tag property instead of id. Since I'm using dynamic inputs and am using javascript to caculate the share totals, I'd like to implement the array design...nice and clean. I could just name them uniquely and use some sort of regex to create the array at the server, but then I'd have to redesign the share calculations and retrieving the values at the server would get dirty.
I haven't found any real-life examples of using arrays, jsut the arrays in the documentation...which I can't get to work. I would LOVE to use hashes...but I haven't seen any reference to it. Does anyone have any ideas for me?
#server code sub editShares_save{ my $self = shift; my $q = $self->query; my $OT = OpenThought->new(); my $params; my @names=$q->param; my @Share=$q->param('Share'); warn (scalar @Share)."\n"; foreach(@names){warn 'name='.($_).' value='.($q->param("$_"))."\n";} } #generated HTML form <table class="tablecontent1"> <tr align='right'> <td></td> <td>Share</td><td></td> </tr><tr> <td> - John Smith </td> <td><input type="text" onkeyup="updateShares()" onblur="formatShar +es(this);updateShares()" name="Share" id="ShareD43C272F-FDEA-0D6C-D3E +0-68357BAB6197" value="0.00"></td> <td>% </td> </tr><tr> <td> - Jane Doe </td> <td><input type="text" onkeyup="updateShares()" onblur="formatShar +es(this);updateShares()" name="Share" id="Share2C0C4234-17D2-CFBC-E39 +3-03FDBE78F6F2" value="0.00"></td> <td>% </td> </tr> </table> <input type='button' value='Save' onclick='save();'> <script> function save(){ var answer=confirm('Are you sure you want to modify this ?'); if(answer){ document.getElementById("save").value=1; showWait(1); var data=["id","save","Share*"]; OpenThought.CallUrl(url, data); } } </script>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: CGI/OpenThought array/hash handling
by Khen1950fx (Canon) on Dec 31, 2010 at 06:41 UTC | |
Re: CGI/OpenThought array/hash handling
by ksublondie (Friar) on Dec 31, 2010 at 16:02 UTC | |
by Anonymous Monk on Dec 31, 2010 at 20:57 UTC | |
by ksublondie (Friar) on Jan 01, 2011 at 00:30 UTC | |
by Anonymous Monk on Jan 01, 2011 at 00:58 UTC | |
by ksublondie (Friar) on Jan 03, 2011 at 16:09 UTC | |
|