[SOLVED] Â BeforeAdd function uppercase |
7/13/2006 4:56:14 PM |
PHPRunner General questions | |
D
drh author
Hi forum, |
|
D
|
Dale 7/13/2006 |
Here is the snippet I use to uppercase the postal code field. |
D
|
drh author 7/14/2006 |
Here is the snippet I use to uppercase the postal code field. I think you just have a bracket missing. Have a compare. function BeforeAdd(&$values) { // Parameters: // $values - Array object. // Each field on the Add form represented as 'Field name'-'Field value' pair //** Custom code **** // put your custom code here $values["postal_zip_code"]=strtoupper($values["postal_zip_code"]); return true; // return true if you like to proceed with adding new record // return false in other case } This worked fine, BUT the user can still type in lower or uppercase in the field. So I added the text-transform: uppercase; to class in the style sheet. Just a tip.
|
D
|
drh author 7/14/2006 |
Hi Dale, Thanks for the reply. Still striking out here. I actually had a paran in the wrong place when compared to your example. I changed the line, but it still does not change the field contents to uppercase. I am not real familiar with the text-transform: uppercase and/or the style sheet. Will check it out soon. If I can get it so that when the user enters data into form it immediately changes the case to upper, then would the data get written to the db in uppercase, or whichever case the user originally used? Here is my entire include/_events.php file. Very short. :-) the BeforeEdit function works properly, but the BeforeAdd function does nothing. Thanks for any help. <?php^M // Parameters: // $values - Array object. // Each field on the Add form represented as 'Field name'-'Field value' pair //** Custom code ****^M function BeforeEdit(&$values,$strWhere) { if ($values["Account_Status"] != "'N'") { $values["Evaluation_Flag"] = "'E'"; } return true; } function BeforeAdd(&$values) { $values["Last_Name"]=strtoupper($values["Last_Name"]); return true; } ?> PS. Dale, hows that web app coming along? Sure looked nice the last time you let me check it out.
|
D
|
drh author 7/14/2006 |
Just thought I might add, I got my laptop back and opened up the project in phprunner. I followed the instructions per the above link and built my application. I then viewed the code in include/_events.php and copied the code php generated into my current include/_events.php file. Still doesn't work. Now my application has been customized some, but the part that is customized deals with the login code. once a user gets logged into a webpage, they do not have to login again into the phprunner created app. I think I probably have some syntax out of whack, but for the life of me, I cannot see it. Thanks again. Dave
|