CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 OnValidate or Other Form-wide Event

Print topic Send  topic

Author Message
DonP
Posted: 11/11/2012, 1:57 PM

I've always been able to use OnValidate as a form-wide event type for
handing non-validation items but as of v5.0, it seems to behave oddly. On my
local development system it's fine but on the live server, Updating or
Inserting simply gives an empty page and no changes were made to the data.
Is there another form-wide event that might be more appropriate? I don't
want to have to repeat the code for each button. Thank you.

Although the issue does not appear to be related to the current OnValidate
code, here it is anyway for reference:

global $DBconn;

if ((!CCGetParam("MenuCaption","") || CCGetParam("MenuCaption","") != 0) &&
CCGetParam("EnterCaption","") && !CCGetParam("SetSpacer","")){
$NewID = CCDLookup("(MAX(ID))+1", "menucaptions", "ID IS NOT NULL",
$DBconn);
$SQL = "INSERT INTO menucaptions (ID, MenuCaption) ".
"VALUES ('". $NewID . "', '" . CCGetParam("EnterCaption","") .
"')";
$DBconn->query($SQL);
$admin_main->MenuCaption->SetValue($NewID);
} elseif ((CCGetParam("MenuCaption","") || CCGetParam("MenuCaption","") ==
0) && !CCGetParam("EnterCaption","") && !CCGetParam("SetSpacer","")){
$admin_main->MenuCaption->SetValue(CCGetParam("MenuCaption",""));
} elseif (!CCGetParam("MenuCaption","") && !CCGetParam("EnterCaption","") &&
CCGetParam("SetSpacer","")){
$admin_main->SetSpacer->SetValue(CCGetParam("SetSpacer",""));
} elseif (!CCGetParam("MenuCaption","") && !CCGetParam("EnterCaption","") &&
!CCGetParam("SetSpacer","")){
$admin_main->MenuCaption->Errors->AddError("<font color=\"red\">A
caption or separator must be selected or a new caption entered.</font>");
}

$admin_main->Body->SetValue(cleanHTML($admin_main->Body->GetValue()));
bannedone


Posts: 273
Posted: 11/11/2012, 2:15 PM

I suspect what is happening is on your online host some php code is giving fits.

The page is displaying blank probably because php display errors is turned off.

In your code (like at the bottom white space in Common.php) turn php errors to display On. Maybe a better place to put this error turn on code is at the very top of the page you are executing. This way all the code will run thru the error display.

Then I think your error will show up and tell U exactly where the problem might be.

I am guessing it has nothing to do with your OnValidate code.

I also believe the OnValidate event is the best place for common form functions.

Let me know how this turns out.

Have Fun
8-)

BTW since it is CCS 5 my bet is on CCS 5 not publishing all the pages to your on-line host or some other file access issue.
I would be interested to know what you find out.. Please let us know

_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
DonP
Posted: 11/11/2012, 10:52 PM

Good idea but unfortunately it didn't help and still works as it should here
on the development system so I uploaded it to the server and it is the same
as before: a blank page! Very odd. I tried setting the errors to the extreme
setting but still nothing so the host may not allow ini changes. Don

"bannedone" wrote in messagenews:550a0236bebd41@news.codecharge.com...

I suspect what is happening is on your online host some php code is giving
fits.

The page is displaying blank probably because php display errors is tuened
off.

In your code (like at the bottom white space in Common.php) turn php errors
to
display On.

Then I think your error will show up and tell U exactly where the problem
might
be.

Let me know how this turns out.

Have Fun
8-)

---------------------------------------
Sent from YesSoftware forum
http://forums.yessoftware.com/
bannedone


Posts: 273
Posted: 11/11/2012, 11:03 PM

Hmmm.. Very odd.

Did you try my modified suggestion in my post above.

If your read from the newsgroup you did not get my entire suggestion as I edited it after some thinking..

Try putting your extreme turning on of error display at the top of the main page you are running.

If your host is not allowing ini changes in php.. This will be difficult to troubleshoot..

In my experience that is the only thing that explains a totally blank page. Especially since it works on your local machine...

What a problem :(

BTW you can see how your host is set up by uploading phpinfo.php to the host and running it to see what settings are set...

_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
PCHome

Posts: 57
Posted: 11/13/2012, 9:16 PM

Actually I finally solved the problem by looking into the server log which told me right away what had happened and I'm a bit embarrassed to have not noticed it sooner. It was simply the very last line calling a custom function and the function script had been moved but the code on the live server where it was being included not changed to load it from the new location! I'm feeling foolish but at least it's working now. Thank you.

Don
View profile  Send private message
bannedone


Posts: 273
Posted: 11/14/2012, 6:30 AM

Hi

Do not feel foolish!!

Wish I had a dime for everytime I have hunted down a problem only to find it was simple.

Glad you found the problem.

Turns out as I mentioned a "file access problem". Your script was not able to open an include file and the fatal php error was from calling a function not included. (Wonder why turning PHP errors on did not display the problem?)

What I normally do in my projects is have every file needed layed out in the project directory structnure. (eg: I create a folder called includes and place any include files I need there). I also normally place all my include lines in the bottom white space in Common.php. This requires looking in only one place when trouble shooting include issues.

Then in my CCS Publishing Settings I always select the last one "All Files excluding extensions ccs;ccp".

This way all files get published including the non ccs pages you might be using as includes.. etc...

Doing this ensures all your site's files will be published.

Have fun
8-)


_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
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.