Re: QuickForm 'static' element suggestion
| From: | Jeff Schmidt | Date: | Mon, 17 May 2004 22:25:41 +0000 |
| Subject: | Re: QuickForm 'static' element suggestion | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-12559@lists.php.net to get a copy of this message | ||
Alexey Borzov wrote:
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Hi! Jeff Schmidt wrote:Well, in this particular case, it's not all that important. But, here's the situation: I've got a form that I'm using to add/update database records. In the case of updating a record, the user goes to a url of the form: scriptname.php?profile=xxx (where xxx is a number which is the key for the database record). I use this value which is initially available to me via $_GET['profile'], and a)stuff it into a form element, 'profileID', and b) use it to fetch the current values from the database and populate the QuickForm with setDefaults() (in the case where profile is not passed in the url, I set the 'profileID' element to the value 0, and of course don't fetch any data from my DB). When the user goes to submit the form, I check the value that is now in the element 'profileID' - there are two levels of checks - the first check is to see if the currently logged in user has the right to modify the profile with the key stored in 'profileID' (so if someone really wants to screw up a record by changing the profileID submitted value, they can only screw up their own record, theoretically). The second level of check is the actual update - I use the value in 'profileID' in some MySQL update and insert statements. Like I said, it shouldn't be too much of an issue, since I check the value to make sure the current user is allowed to update the record in question. But, it just seems to me like they don't need to change that value, the way my app is designed, so I might as well make it immutable. Jeff SchmidtI have a page, where I want to be able to pass some data through a quickform. That is, I want the data to be part of the QuickForm, even be able to display it to the user, but have it be immutable. I thought that the 'static' element type would be perfect. It does indeed allow me to display the data to the user without the user being able to modify it. However, it isn't available to me when I go to process the form!I sense some contradiction: if the value should be immutable, why do you need it at all for processing the form?..
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc