
jkelley
Posts: 2
|
| Posted: 08/08/2008, 1:19 PM |
|
I have a detail record as an editable grid that has a list of IP addresses in dot format, but stored in mysql as 32 bit longs. So on the before show I use custom code to convert these to dot format using long2ip, works great no problem.
Now,I know I need to convert them back before the fields are validated, inserted, updated,etc. I am thinking that the best place would be in the before submit for the grid control, but have had no luck.
I have tried using code in the before submit, but still have a validation error.
Error example: The value in field Local Ip is not valid. (in red, after submitting).
Custom Code in before submit:
$termination_networks->local_ip->Value=ip2long($termination_networks->local_ip->Value);
Any ideas?
Thanks.
|
 |
 |
jkelley
Posts: 2
|
| Posted: 08/11/2008, 12:39 PM |
|
Solved it, just in case anyone wants to know:
1) In the form I changed the field types to "text" to clear the error messages.
2) The actual Before Show Row event code is:
$termination_networks->local_ip->SetValue(long2ip($termination_networks->local_ip->Value));
2) Added custom code to the Before Insert, Before, Update to convert the IPs back to longs.
$termination_networks->DataSource->local_ip->SetValue(ip2long($termination_networks->DataSource->local_ip->Value));
There is also code to check to see if it's null, if so not convert. But this is the meat of the of it.
Done!
|
 |
 |
|

|
|
|
|