PDOCrud Set value of a form field (updated in v 4.3)

You can set some default value of field in insert form. For example, in your table, you may have field name created by, which you don't want to fill by user (instead this you want this to be logged in user id) but you want to save that value in table.

Updates in v 4.3 - Before v 4.3, if you want to hide the value, you need to use the "style = display:none". In v 4.3, we have added option to hide the field so it will be completely hidden from user.

  
                               $pdocrud = new PDOCrud();
                                /**
                                 * Set a value of field
                                 * @param   string   $fieldName                            field name to renamed
                                 * @param   string   $value                                value of the field
                                 * @param   bool     $fieldHidden                          Wheter that field is hidden or not
                                 * @param   string   $tablename                            Tablename = Required only when using join table field name
                                 * return   object                                         Object of class
                                 */
                                $pdocrud->formFieldValue("customer_id", "1");//set some default value for customer Id 
                                $pdocrud->fieldDataAttr("customer_id", array("disabled"=>"disabled"));
                                //or you can entirly hide that field also
            //                $pdocrud->fieldHideLable("customer_id");
            //                $pdocrud->fieldDataAttr("customer_id", array("style"=>"display:none"));


                                //hide another field payment_method and set it's value to "cash"
                                //step 1 hide and set value
                                $pdocrud->formFieldValue("payment_method", "cash", true);//set some default value for payment_method
                                //step 2 remove this field from form field list (you can use formFields function or formRemoveField function)
                                $pdocrud->formFields(array("customer_id","order_amount","order_date"));
                                echo $pdocrud->dbTable("ordertable")->render("insertform");
                                

Deprecated: Optional parameter $op declared before required parameter $task is implicitly treated as a required parameter in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOCrud.php on line 983

Deprecated: Creation of dynamic property PDOCrud::$langData is deprecated in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOCrud.php on line 2227

Deprecated: Optional parameter $page declared before required parameter $totalrecords is implicitly treated as a required parameter in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOCrudHelper.php on line 191

Deprecated: Optional parameter $parameters declared before required parameter $data is implicitly treated as a required parameter in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOCrudTableFormat.php on line 122

Deprecated: Creation of dynamic property PDOCrud::$formFieldHide is deprecated in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOCrud.php on line 956

Deprecated: Creation of dynamic property PDOModel::$characterSet is deprecated in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOModel.php on line 119

Deprecated: Creation of dynamic property PDOModel::$characterSet is deprecated in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOModel.php on line 119

Deprecated: strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOModel.php on line 1011

Deprecated: strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOModel.php on line 1011

Deprecated: Creation of dynamic property PDOCrud::$dataHTML is deprecated in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOCrud.php on line 2379

Deprecated: Creation of dynamic property PDOCrud::$fieldList is deprecated in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOCrud.php on line 2380