HTML_QuickForm: setType not changing get_class_methods

From: Date: Thu, 09 Dec 2004 00:58:19 +0000
Subject: HTML_QuickForm: setType not changing get_class_methods
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16126@lists.php.net to get a copy of this message
Hello, I am using DB_DataObject_Formbuilder (0.9.0 beta). I have a field in a table that I change to a file type so the user can upload an image. Like so: $file =& $form->getElement('presenting_image'); $file->setType('file'); This shows up & works correctly in my form (ie, an image field with browse button appears). Problem is, when the form is processed and I go to process and upload the image, like so... if( $form->validate()){ $form->process('process', true); ... } The process function I am calling is this; function process( $values ){ global $file; if ($file->isUploadedFile()) { $file->moveUploadedFile($values['path']); } } I get the following error message: Fatal error: Call to undefined function: isuploadedfile() in /usr/local/psa/home/vhosts/morchand.com/httpdocs/admin/programs/create.new.spcase/index.php on line 22 Looked like it didn't have the proper method to the object so I printed out some debug info( all below). The upshot is, even though it prints out 'file' when asked for it's type, it seems to have the methods of a text input, not a file input. Does changing an element by using setType() not work in the way I am expecting it to work? Feel free to correct my thinking or methodology. I am trying to access the method for HTML_QuickForm_file, isUploadedFile(), which I thought would be accessible to me if I changed the element type to 'file'. Thanks, Sarah **** DEBUG INFO: When I echo $file->getType(); it prints out 'file' When I print_r($file) it prints out: html_quickform_text Object ( [_attributes] => Array ( [name] => presenting_image [type] => file [value] => D:\mydocs\16765023_xl.jpe ) [_tabOffset] => 0 [_tab] => [_lineEnd] => [_comment] => [_label] => Presenting Image [_type] => file [_flagFrozen] => [_persistantFreeze] => 1 ) a when I print_r(get_class_methods($file)) it gives the list of methods associated with a text input object: Array ( [0] => html_common [1] => apiversion [2] => _getlineend [3] => _gettab [4] => _gettabs [5] => _getattrstring [6] => _parseattributes [7] => _getattrkey [8] => _updateattrarray [9] => _removeattr [10] => getattribute [11] => setattributes [12] => getattributes [13] => updateattributes [14] => removeattribute [15] => setlineend [16] => settaboffset [17] => gettaboffset [18] => settab [19] => setcomment [20] => getcomment [21] => tohtml [22] => display [23] => html_quickform_element [24] => gettype [25] => setname [26] => getname [27] => setvalue [28] => getvalue [29] => freeze [30] => getfrozenhtml [31] => _getpersistantdata [32] => isfrozen [33] => setpersistantfreeze [34] => setlabel [35] => getlabel [36] => _findvalue [37] => onquickformevent [38] => accept [39] => _generateid [40] => exportvalue [41] => _preparevalue [42] => html_quickform_input [43] => settype [44] => html_quickform_text [45] => setsize [46] => setmaxlength )

« previous php.pear.general (#16126) next »