CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 [Solved]: Editable Grid - Modify contents, before validate?

Print topic Send  topic

Author Message
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.
View profile  Send private message
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!
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.