This topic is locked

How to format entries made via Add new values on the fly

10/30/2007 7:08:48 AM
PHPRunner General questions
L
Lisa2006 author

Table: journey

Field: starttown
Table: town

Field: town
I have created a Lookup Table on the journey Table via the ADD Page on the Field starttown.
Table: town

Link Field: town

Display Field: town

Allow to add new values on the fly & Lookup wizard as Edit box with AJAX popup have been checked.

View as Custom: $value = ucwords(strtolower($value));
));
Here's the problem:

When i click the Add new link and enter a town ... i.e LondON, it display correctly on the LIST Page as London.

However, when i look at the physical database the field show as LondON.
If another user was to select london as the starttown, then the AJAX selection would simply present LondON.
How can i ensure that any entries made via the Add new link can be formatted correctly before being populated to the physical database.
Your urgent help would be much appreciated.
Lisa

J
Jane 10/30/2007

Lisa,
to fix it open generated ..._addnewitem.php file, find this code:

$strSQL = "insert into ".AddTableWrappers($table)." (" . AddFieldWrappers($dispfield) . ") values (" . $strValue . ")";

and replace it with this one:

$strSQL = "insert into ".AddTableWrappers($table)." (" . AddFieldWrappers($dispfield) . ") values (" . ucwords(strtolower($strValue)) . ")";