This topic is locked

Uppercase / ProperCase -V3.0

9/19/2006 10:42:28 AM
PHPRunner General questions
M
mmponline author

I have a project that would take to long to convert into v3.1. I need to have certain fields to show in upper and proper case in List and view pages.
I've tried the following code in events - custom code but don't get the desired results.
$values["division"]=strtoupper($values["division"]);

return true;
I tried without return true; as well - as described on the xlinesoft.com site.es
I also tried adding it to the add and edit pages as described on the site.
I get either no result or "error on page" undefined syntax message.
Please help where I'm going wrong.

T
thesofa 9/19/2006

Hi

you could try doing it through MYSQL rather than through PHP.

In your sql query you could have the expression proper(`division`), in the selection list.

That should always show the contents of the field as proper case.

HTH

Sergey Kornilov admin 9/19/2006

Here is the code for PHPRunner 3.1 Custom Expression "View as" type.

$str = $value;
for ($i=0; $i<strlen($str); $i++)

{

if ($i==0)

$b = True;

else

$b = (substr($str, $i-1,1) == " ");

if ($b)

$str = substr($str,0,$i).strtoupper(substr($str, $i,1)).substr($str, $i+1);

else

$str = substr($str,0,$i).strtolower(substr($str, $i,1)).substr($str, $i+1);

}
$value = $str;
M
mmponline author 9/19/2006

When pasting this code in the custom box of the field I want changed in visual editor, I get the following error box when going to next step.

source\ files.txt(8) -Couldn't find element BMenuItem. - It pos up a few times.
Unfortunately, the coding is then lost on return to the visual editor and the page saved like that. I then loose ALL editing done previously as I need to reset the page properties.
It seems like visual editor saves automatically when going to the next step. There are obviously some advantages to that, but the disadvantage is that you can't close the project without saving to recover your old info.
Is this code maybe meant for 3.0 or did I enter it in the wrong place?

kujox 9/20/2006

Is this code maybe meant for 3.0 or did I enter it in the wrong place?


try entering in to the event you need, ie add, before add etc
It might be easier to place in a function and just call it when you need it