Re: $reg->param, $req->body - is there a way to set form data?
Jonathan Vanasco <[email protected]>
| Newsgroups | gmane.comp.apache.apreq |
|---|---|
| Message-ID | <[email protected]> |
On Oct 27, 2006, at 8:25 PM, Philip M. Gollucci wrote: > You can not, they are readonly versions of APR::Table (apr_table_t) > > You could always copy the structure to a hash somewhere. Also, > check the archvies of this > list, I know someone (probably joes) posted an answer to this > question before. Just to add- I think that approach can lead to some big problems. I'd strongly suggest having a Form class, or some 'untaint' class, loop through the necessary fields -- pulling them from APR::Table, and validating/untainting them -- then just deal with those values. Personally, I have a class that does this: Loop through values & validate valid data gets cleaned ( lead/trailing whitespace stripped, int() numerics ), and stored in an cleaned hash errors get marked in a hash that has an error code keyed to the field if scalar keys %errors : reprint form using the valid array as defaults else: do biz logic on the valid data // Jonathan Vanasco | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | FindMeOn.com - The cure for Multiple Web Personality Disorder | Web Identity Management and 3D Social Networking | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | RoadSound.com - Tools For Bands, Stuff For Fans | Collaborative Online Management And Syndication Tools | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -