Forums

loadObjectList in the auto generated tab

ameron 08 Oct, 2008
Hello everyone,

I have a problem using ChronoForms ( I'm using version 2.3.8 ):
I retrieve data from a database also in the auto generated tab code. The code itself seems to work properly, but the redirect url is not opened; I have a blank page instead. I tried to localize the problem and the problematic line seems to be the following:

$rows = $database->loadObjectList();

In fact, if I comment that line, the redirect url works fine.
My question is: is the use of the function loadObjectList() forbidden in the auto generated tab code?

Thank you very much in advance
Max_admin 08 Oct, 2008
Hi ameron,

actually this line should make no problems at all, show me your auto generated code!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ameron 09 Oct, 2008
Hi,

thank you very much for your reply.
The code in the auto generated tab is quite long, so I attach it as a text file.

It is possible that it is not bug free since I haven't tested all its features yet because of this loadObjectList problem that prevent the redirect url to be opened.

Thanks for your help!
GreyHead 09 Oct, 2008
Hi ameron,

I'd guess that the sql query is probably returning no results and so there isn't an object list to load.

What happens when you test "SELECT id, name, department FROM customers;" with PHPMyAdmin?

Bob
ameron 09 Oct, 2008
Hi Bob,

I just tested it and the result is as expected the three requested fields (id, name and department) of every entry in the 'customers' table, which are many, not 0.
GreyHead 09 Oct, 2008
Hi ameron,

Hmmm . . . not obvious, the $database->loadObjectList() call looks perfectly good to me.

The redirect code *shouldn't* be called until after the autogenerated code ends.

I think my next move woudl be to put debug code into the autogenerated code to find out more of what is going on.

Bob

PS There was one version of ChronoForms that had a bug if you used a redirect code - I thought that it was later than 2.3.8 though and had different symptoms.
Max_admin 09 Oct, 2008
Hi ameron,

I didn't check your code yet but keep your redirect and put
<?php echo "test"; ?>
at the top of the auto generated code block and outside the other PHP block, can you see "test" at the blank page ?

Cheers

max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ameron 09 Oct, 2008
Thank you both!

Max, I'm not sure I got where to put your "test" code. I put it in the beginning and in the end of the auto generated code; is that right? Basically now both the first and the last line of my auto generated code are <?php echo "test"; ?>

The result is that in the blank resulting page now appears "testtest", so both the echoes are executed.
Max_admin 09 Oct, 2008
ok, then try this code in the autogenerated box, backup and remove all other code :

<?php 
echo "count= ";
global $database;
$database->setQuery( "SELECT * FROM jos_components" );
$rows = $database->loadObjectList();
echo count($rows);
?>


what can you see now ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ameron 10 Oct, 2008
I just tried and the result is the blank page with "count= 63" printed in it. No redirect.
GreyHead 10 Oct, 2008
Hi ameron,

So it seems as though the SQL is all working OK but you aren't getting passed to the redirect command.

Just testing, if you comment out the $rows = . . . line does the ReDirect work then?

What url is in the ReDirect?

Probably the next thing is for Max or me to logon to your site and take a close look - I'd add debug code to try to track down exactly what is happening.

You can contact me through the links under my picture to at the email address in my sig.

Bob
ameron 10 Oct, 2008
Hi Bob,

That's exactly what happens: when I comment the $rows = ... line, the redirect works fine again.

The redirect url is "index.php?option=com_content&task=view&id=38", just a static content page.
GreyHead 10 Oct, 2008
Hi ameron,

Hmmm . . . the only reason I can think of is that there is some kind of PHP failure happening and the script is dying . . . but you see no message and the SQL executes OK so I'm baffled at the moment.

Bob
ameron 10 Oct, 2008
Hi Bob,

Would it help if I update Chrono Forms to the last version available? I noticed the one I'm using is not up-to-date.
GreyHead 10 Oct, 2008
Hi ameron,

Absolutely it would help. BUT, there is no automatic upgrade path from CF 2.3.8 to CF 3.0, youll need to back up your form data and your forms carefully, then reconstruct the forms in CF3.0 by copying and pasting the code into place, test the form, then re-insert any data into the new tables. It's tedious but not difficult, you ca probably do a average form in ten minutes or so (maybe longer for the first one!).

Bob
ameron 10 Oct, 2008
Hi Bob,

By the way, I'm using Joomla version 1.0.15.
Version 3.0 of CF works only with Joomla 1.5, is that right? Would my right update be CF 2.3.9? And in that case, is that possible just to update without rebuilding all the forms?

Ameron
GreyHead 10 Oct, 2008
Hi ameron,

Yes you can update to 2.3.9 OK, get the upgrade and FTP the files over the exisiting ChronoForms folders - they should be packaged so that you can do that all in one go.

Backup forms and data first for security.

When you have upgraded it is just possible that you will need to patch chronocontact.php some versions were buggy but I've lost track of exactly which was which.

Bob
ameron 10 Oct, 2008
Hi Bob,

Thanks a lot, I'll try the update. Let's see if after that something changes.

Ameron
ameron 10 Oct, 2008
Hi Bob,

After the update the behaviour of the auto generated doesn't change, everything works exactly as before.
Apparently no SQL or PHP errors, but still no redirect...

Maybe I can just manage without using the redirect function.

Ameron
Max_admin 10 Oct, 2008
Hi ameron,

at the end of the autogenerated code and before the php closing tag ?> add this :

mosRedirect("index.php?option=com_content&task=view&id=38");


does it work this way ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ameron 10 Oct, 2008
Hi Max,

Yes, it does!! That's great, thanks a lot!
Do you think I can keep using this solution without any trouble?

Ameron
Max_admin 10 Oct, 2008
Hi Ameron,

yes you can!

Cheers,

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.