Forums

Dynamic dropdown worries

rodiusd 15 Oct, 2013
Hi,

got a dynamic dropdown, but the result in my second dropdown is some HTML. Seems to be a part of the template. See attached file.

Checked my function who loaded the data:
<?php
$cfg = parse_ini_file('config.ini',true);

$db2 = new MySQLi($cfg['dbconn']['host'],$cfg['dbconn']['user'],$cfg['dbconn']['password'],$cfg['dbconn']['database']);

// get Playdates
$results = array();
$results[] = '0=Please select';
$query = "SELECT
            teams_events.id as id,
            concat(date_format(events.eventdate,'%d/%m/%Y'),' - ', events.description) as playdate
          FROM
            teams_events
            INNER JOIN events ON (teams_events.eventID = events.id)
          WHERE
            events.seasonID = 3 AND
            teams_events.clubID = 339 AND
            teams_events.teamID = 2 AND
            teams_events.complete = 'N' AND
            events.eventdate < curdate()
          ORDER BY
            events.eventdate";
if ($rs = $db2->query($query)) {
    /* fetch associative array */
    while ($row = $rs->fetch_assoc()) {
        $results[] = $row['id'].'='.$row['playdate'];
    }
    /* free result set */
    $rs->free();
}
$results = implode("\n", $results);
echo $results;
$mainframe =& JFactory::getApplication();
$mainframe->close();
?>

en got followed result who is returned:
string '0=Please select
2=06/09/2013 - Interteams 1
5=13/09/2013 - Interteams 2
8=20/09/2013 - Interteams 3
11=27/09/2013 - Interteams 4
14=04/10/2013 - Interteams 5
17=11/10/2013 - Interteams 6' (length=186)


So i don't know why i getting this strange html respons in my second dropdown box.

Someone an idea?
Max_admin 17 Oct, 2013
Hi rodiusd,

Please check your code carefully and try to run the event in your browser window, maybe there are some errors returned with the data ?

You may also write the results in a custom code box:
0=Please select
2=06/09/2013 - Interteams 1
5=13/09/2013 - Interteams 2
8=20/09/2013 - Interteams 3
11=27/09/2013 - Interteams 4
14=04/10/2013 - Interteams 5
17=11/10/2013 - Interteams 6

To make sure that they are returned fine with no PHP code error, if you still get the same HTML then there is some thing else to fix.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rodiusd 17 Oct, 2013
Hi Max,

checked and no error was show. returned string has no spaces before or after.
Don't see where the problem is.
Max_admin 17 Oct, 2013
Are you sure? the direct ajax event link in your browser returned the results only ? if yes then please send me a link to the form here or using the contact us page so that I can test the ajax response in my browser.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rodiusd 18 Oct, 2013
Hi Max,

in the dynamic dropdown is must enter in the "Extra options extension" something otherwise the event is not fired. With the standard joomla settings we get an error and this is the cullprit of the funny html data in the dropdown box.

To elimate this we must change the followingin the " Joomla 'Global configuration" -> "Server" -> "Error reporting" to none.

Then the dropdown is filled correctly. Is there a way to correct this without changing the Joomla settings?
GreyHead 18 Oct, 2013
Hi rodiusd,

What exactly is the error message that gets thrown up? You should be able to see that in your browser web developer tools (on the Net tab in Chrome).

The image looks like a whole page is being returned and is being parsed as though it was an options list i.e. Picking out what is before and after the = signs.

Bob
rodiusd 18 Oct, 2013
Hi Bob,

got the screenshot included in a zip file
GreyHead 18 Oct, 2013
Hi rodiusd,

There's a possible fix in this post - see item f.

Bob
rodiusd 18 Oct, 2013
Hi Bob,

try it out and let you know the outcome.
rodiusd 19 Oct, 2013
Hi Bob,

is working. Thanks. could you also take a look at my last post.

Its about the same subject but added Part 2.
This topic is locked and no more replies can be posted.