Hi to all,
I'm trying to create a double drop down with ChronoForms v4. I bought the Bob's manual (http://greyhead.net/how-to-docs/chronoforms-v4-using-ajax).
I copy/pasted all the example's code at the end of that book (obv changing the form's name), but when i select the state, instead of a list of countries appears the message "Powered By ChronoForms - ChronoEngine.com" 😲 😲
This is what I did:
1) Copy/Pasted the "Form HTML" code, inside the "HTML code" in the tab "Code" of the form
2) Copy/Pasted the "The Form JavaScript" code, inside the "Load JS" in the "On Load" event of the Advanced Widzard.
3) Created a new event with the name "ajax" and copy/pasted the "The Ajax event Custom Code" code inside a "Custom Code" element.
4)The only code I wrote is for mysql:
I don't know if I can post the rest of the code, cause it's completely taken from that manual, so I need the permission of the author.
Thanks in Advance
P.S.:
Chronoforms V. 4.0 RC3.11
Joomla! V. 2.5.4
I'm trying to create a double drop down with ChronoForms v4. I bought the Bob's manual (http://greyhead.net/how-to-docs/chronoforms-v4-using-ajax).
I copy/pasted all the example's code at the end of that book (obv changing the form's name), but when i select the state, instead of a list of countries appears the message "Powered By ChronoForms - ChronoEngine.com" 😲 😲
This is what I did:
1) Copy/Pasted the "Form HTML" code, inside the "HTML code" in the tab "Code" of the form
2) Copy/Pasted the "The Form JavaScript" code, inside the "Load JS" in the "On Load" event of the Advanced Widzard.
3) Created a new event with the name "ajax" and copy/pasted the "The Ajax event Custom Code" code inside a "Custom Code" element.
4)The only code I wrote is for mysql:
-- phpMyAdmin SQL Dump
-- version 3.1.3.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generato il: 18 ott, 2010 at 09:42 PM
-- Versione MySQL: 5.1.33
-- Versione PHP: 5.2.9
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `xxx`
--
-- --------------------------------------------------------
--
-- Struttura della tabella `jos_geopc_us`
--
CREATE TABLE IF NOT EXISTS `jos_geopc_us` (
ID bigint(20) NOT NULL,
ISO2 varchar(6) NOT NULL,
Region1 varchar(60) NOT NULL,
Region2 varchar(60) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Dump dei dati per la tabella `jos_geopc_us`
--
INSERT INTO `jos_geopc_us` (`id`, `ISO2`, `Region1`, `Region2`) VALUES
(1, 'IT-PI', 'Piemonte', 'Torino'),
(2, 'IT-PI', 'Piemonte', 'Alessandria'),
(3, 'IT-PI', 'Piemonte', 'Asti'),
(4, 'IT-LO', 'Lombardia', 'Milano'),
(5, 'IT-LO', 'Lombardia', 'Bergamo'),
(6, 'IT-LO', 'Lombardia', 'Como');
I don't know if I can post the rest of the code, cause it's completely taken from that manual, so I need the permission of the author.
Thanks in Advance
P.S.:
Chronoforms V. 4.0 RC3.11
Joomla! V. 2.5.4
Hi fasenderos ,
Please post a link to the form so I can take a quick look. It sounds as though nothing is being returned from the Ajax call.
You probably need to add a Show STopper action to the ajax action to prevent the strap-line from displaying.
Bob
Please post a link to the form so I can take a quick look. It sounds as though nothing is being returned from the Ajax call.
You probably need to add a Show STopper action to the ajax action to prevent the strap-line from displaying.
Bob
Hi Bob,
here's the link
Thanks
Andrea
*edit: I have added a Show STopper action to the ajax action. Now when you select the state, in the county field appears "searching..." for 2 seconds, and then nothing
here's the link
Thanks
Andrea
*edit: I have added a Show STopper action to the ajax action. Now when you select the state, in the county field appears "searching..." for 2 seconds, and then nothing
Hi Andrea,
Checking with FireBug shows that what is being returned is the ChronoForms strap-line (adding the Show Stopper should have blocked this) and a 500 Internal Server error. So I suspect that there is a problem with the code in the Ajax event.
Please re-copy and paste the Ajax code here so I can see if anything has got lost in the the various moves.
Bob
Checking with FireBug shows that what is being returned is the ChronoForms strap-line (adding the Show Stopper should have blocked this) and a 500 Internal Server error. So I suspect that there is a problem with the code in the Ajax event.
Please re-copy and paste the Ajax code here so I can see if anything has got lost in the the various moves.
Bob
Hi Bob,
here's the Ajax code
Andrea
here's the Ajax code
<?php
$state_id =& JRequest::getString('sid', '', 'post');
if ( $state_id ) {
$db =& JFactory::getDBO();
$query = "
SELECT DISTINCT `Region2` AS `id`, `Region2`
FROM `#__geopc_us`
WHERE `ISO2` = '$state_id'
ORDER BY `Region2`;
";
$db->setQuery($query);
$data = $db->loadObjectList();
if ( count($data) ) {
$m = new stdClass();
$m->id = 0;
$m->Region2 = '==?==';
$data = array_merge(array($m), $data);
$return = JHTML::_('select.genericlist', $data, 'Region2',
'class="inputbox required select" size="1" ', 'id', 'Region2',
} else {
$return = "Sorry, we couldn't find that state";
}
} else {
$return = "Sorry, we couldn't find a state id";;
}
echo $return;
// stop any further processing
$mainframe->close();
?>
Andrea
Hi Andrea,
Please try to include this line before the last one:
Regards,
Max
Please try to include this line before the last one:
$mainframe =& JFactory::getApplication();
Regards,
Max
Hi Andrea,
Please try to include this line before the last one:
$mainframe =& JFactory::getApplication();
Regards,
Max
Hi Max,
I added that code, but didn't works.
Regards
Andrea
Hi,
Try to access the AJAX event using your browser directly, make sure it works and gives the correct results without any errors.
example: index.php?option=com_chronoforms&chronoform=my_form&event=XXXXXX
Try to access the AJAX event using your browser directly, make sure it works and gives the correct results without any errors.
example: index.php?option=com_chronoforms&chronoform=my_form&event=XXXXXX
Hi Max,
sorry but I'm not a wizard, so i don't know if there are any errors..the form's name is "prova" and the Ajax event name is "ajax"...this is the link, can you check it for me?
Thanks,
Andrea
sorry but I'm not a wizard, so i don't know if there are any errors..the form's name is "prova" and the Ajax event name is "ajax"...this is the link, can you check it for me?
Thanks,
Andrea
I'm getting a full page load there, so its not working correctly, what's the code you have there now ?
In the "On ajax" event i have a Show Stopper action and a Custom Code action with that ajax code
Regards
<?php
$state_id =& JRequest::getString('sid', '', 'post');
if ( $state_id ) {
$db =& JFactory::getDBO();
$query = "
SELECT DISTINCT `Region2` AS `id`, `Region2`
FROM `jos_geopc_us`
WHERE `ISO2` = '$state_id'
ORDER BY `Region2`;
";
$db->setQuery($query);
$data = $db->loadObjectList();
if ( count($data) ) {
$m = new stdClass();
$m->id = 0;
$m->Region2 = '==?==';
$data = array_merge(array($m), $data);
$return = JHTML::_('select.genericlist', $data, 'Region2',
'class="inputbox required select" size="1" ', 'id', 'Region2',
} else {
$return = "Sorry, we couldn't find that state";
}
} else {
$return = "Sorry, we couldn't find a state id";;
}
echo $return;
// stop any further processing
$mainframe =& JFactory::getApplication(); <-- Added after your suggestion
$mainframe->close();
?>
Regards
Hi fasnaderos,
I think that this link
Bob
I think that this link
http://www.onlinecontabilita.it/index.php?option=com_chronoforms&chronoform=prova&event=ajax
needs to be http://www.onlinecontabilita.it/index.php?option=com_chronoforms&chronoform=prova&event=ajax&tmpl=component
otherwise the template will be included in the returned result and you get the 'full page' that Max described.Bob
Hi,
I have the same configuration, but with this error when repositioned to select's value to 0:
Object #<HTMLSpanElement> has no method 'setHTML'
Thank!
Matteo
I have the same configuration, but with this error when repositioned to select's value to 0:
Object #<HTMLSpanElement> has no method 'setHTML'
Thank!
Matteo
Hi Matteo,
I have to test this, please post a link here or send it through the contact us page.
Regards,
Max
I have to test this, please post a link here or send it through the contact us page.
Regards,
Max
Any news?
Thank!!
Matteo
Thank!!
Matteo
HI Matteo,
I suggest that you try replacing this line
Bob
I suggest that you try replacing this line
$m->id = 0;
with$m->id = '';
This will give the ==??== option an empty value instead of 0 which seems to be causing the problem.Bob
Hi Bob.
I have a similar problem, and I tried several things and it seems that the problem is not being called the event containing the ajax, allways recibe the same message in the drop-down:loading Failed.
I load my data in a custom php in a event called ajax, i add the custom code.
Thanks in advance!!
I have a similar problem, and I tried several things and it seems that the problem is not being called the event containing the ajax, allways recibe the same message in the drop-down:loading Failed.
I load my data in a custom php in a event called ajax, i add the custom code.
Thanks in advance!!
Tanks Bob, here is the link! http://support.lingolearn.com/index.php?option=com_chronoforms&chronoform=Student_Login
🙂
🙂
Hi Davila,
Checking in my Browser Web Developer tools I see a 500 Internal Server error and a System Message about Ajax. If I call the Ajax URL directly I just see the ChronoForms strapline which makes me wonder if the call is to the right event. Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.
Bob
Checking in my Browser Web Developer tools I see a 500 Internal Server error and a System Message about Ajax. If I call the Ajax URL directly I just see the ChronoForms strapline which makes me wonder if the call is to the right event. Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.
Bob
This topic is locked and no more replies can be posted.