Forums

How to trigger Ajax Enabled DropDown [P] on Onload event

neuronageek 19 Jun, 2013
...programmatically, without changing selection of dropdown.

I suposse that will be made with a javascript call to run method of action, but I'm very newbie with Chronoforms until now and need your help.

thanks!
GreyHead 20 Jun, 2013
Hi neuronageek,

Looking at the code I think that the call would be load_req.send('name=value');

Bob
neuronageek 21 Jun, 2013
Thanks, Bob.

This is for newbies like me: Example triggering "Ajax Enabled Dropdown [P]" when clicking a button. This helps me to re-use the action to be fired when clicking on button to "see "more info" of one item (really, to see the info loaded by DB Multi record loader).

Thanks!

On Onload (JS) event


window.addEvent('load', function() {
$('button_id').addEvent('click', function(){
 var load_req = new Request(
{
url: 'index.php?option=com_chronoforms&chronoform=form_name&event=event_name[/color]',
method: 'get', onRequest: function(){
$('destinationcontainer_id').empty();
new Element('div', {'value': '', 'text': 'Loading...'}).inject($('destinationcontainer'));
   },	onSuccess: function(responseText) {
              $('destinationcontainer').empty();
	      $('destinationcontainer').set('html', responseText);
	},
	onFailure: function() {
	     $('destinationcontainer').empty();
             new Element('div', {'value': '', 'text': 'Fallo en la carga.'}).inject($('destinationcontainer'));
	}
});
					load_req.send($('sourcedropdown').get('name')+'='+$('sourcedropdown').get('value'));
});
});
GreyHead 23 Jun, 2013
Hi neuronageek,

Thank you :-)

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