Forums

Option box not loading data

sand groper 13 Apr, 2009
Hello,

Have have been playing around with Chrono Connectivity for a couple of days now. I found the tutorial 1 very helpful however I can't seem to get the option box to work it just displays part of the option value code. I have used the categories table as my option value list to test. Can anyone see what I am doing wrong?

<?php
?>
<table>
<tr>
<td>Product name:</td><td><input type="text" name="product_name"></td>
</tr>
<tr>
<td>Date created:</td><td><input type="text" name="date_created"></td>
</tr>
<tr>
<td>Supplier:</td>
<td>
<select name="cat_id">
<?php
            $database->setQuery( "SELECT * FROM #__categories" );
            $categories = $database->loadObjectList();
            foreach($categories as $category){
        ?>
            <option value="<?php echo $category->id; ?>"><?php echo $category->title; ?></option>
        <?php } ?>
</select>
</td>
</tr>
</table>
<input type="hidden" name="id" value="">


Also if I remove the <?php ?> code from the top I get this error on the frontend edit page.

Parse error: syntax error, unexpected $end in mysitedirectory/components/com_chronoconnectivity/chronoconnectivity.html.php(283) : eval()'d code on line 27

Thank you ;c)
GreyHead 13 Apr, 2009
Hi sand groper,

The code looks OK to me - exactly what output do you get? That might give a clue.

Bob
sand groper 14 Apr, 2009
Hello Bob,

Thanks for your quick reply.

The drop down box in the frontend edit page has "title; ?>" (without the quotation marks)

I have also attached screen print which shows the drop down box with that code in it.

Regards,

Russel
GreyHead 14 Apr, 2009
Hi sand groper,

That tells me that it is seeing the > in $category->title as ending the <option . . .> tag - can't see why though. Try this
<?php
            $database->setQuery( "SELECT * FROM `#__categories`; " );
            $categories = $database->loadObjectList();
            foreach($categories as $category){
                echo"<option value='".$category->id."'>".$category->title."</option>";
            }
?>
</select>

Bob
sand groper 14 Apr, 2009
Hi Bob,

It puzzled me I spent queit abit of time searching forums and php.net to try and fix before posting.

I pasted in the code as suggested and I still get the error with the exception of the different wording which now displays in the drop down box as id."'>".$category->title."] again I have attached screen shot.

Could it be something else besides the select code. For example I added <?php ?> to the top of the record edit template as I was getting this error without it: Parse error: syntax error, unexpected T_LNUMBER, expecting ',' or ';' in /hermes/web06/b998/pow.angelfire/htdocs/components/com_chronoconnectivity/chronoconnectivity.html.php(283) : eval()'d code on line 17

Russel
GreyHead 14 Apr, 2009
Hi sand groper,

Does look like a stray unclosed tag of some kind. [sendfb][/sendfb]
Bob
sand groper 14 Apr, 2009
Bob

I have downloaded, zipped and attached backup of my chronoforms form.

This is not the same form that I am having problem with though as this is a chronoform, and form with error is in chronoconnectivity?

Russel
GreyHead 14 Apr, 2009
Hi Russel,

Sorry, I failed to read the forum headings :-( We do need a backup facility for ChronoConnectivity too.

Bob
sand groper 14 Apr, 2009
I have just tested the program on another one of my sites which is on the same server as well as a friends site which is on another server to check if server issue and still same error.

Spent another 4 hours searching forums, but still no answers I am convinced it must be something simple I have missed which effects edit form. Can I give you temporary access to backend of my site to see if you can spot anything?

Russel
GreyHead 14 Apr, 2009
Hi Russel,

Sure PM or Email me a SuperAdmin logon please (and the site url) - it's evening here so I may not get to look until tomorrow morning.

Bob
sand groper 16 Apr, 2009
Bob

I have sent email to you with login details.

Thank you.

Russel
GreyHead 16 Apr, 2009
Hi Russel,

I don't see it in my inbox :-( Try a PM here.

Bob
GreyHead 16 Apr, 2009
Hi Russel,

I've got it working - but a bit of a lash-up, I seem to recall that there was a bug in ChronoConnectivity in parsing '>' so I've replaced them with entities:
<?php
$database->setQuery( "SELECT * FROM `#__categories`; " );
$categories = $database->loadObjectList();
global $mainframe;
echo "<select name='cat_id' >";
foreach ( $categories as $category ) {
    echo "<option value='".$category->id."'>".$category->title."</option>";
}
?>
</select>
<input type="hidden" name="id" value="">

Bob
sand groper 16 Apr, 2009
I don't think I would have worked that out on my own.

......I just checked out... yahoo it is working!!!

Did a bit of searching on the connectivity forums before couldn't seem to find anyone else with this problem, hopefully this will help them to now.

Thanks Bob you are a genius!!😀

Regards,

Russel
This topic is locked and no more replies can be posted.