Dropdown on Change event

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
scampollo
Posts: 6
Joined: 2014-07-02 16:33

Dropdown on Change event

Post by scampollo » 2015-08-13 00:26

I'm trying to modify the behavior of a form when someone changes a dropdown value in my generated application so I used the code provided by appgini in the Help/Advanced Topics/Magic Files section (http://bigprof.com/appgini/help/advance ... agic-files) :

Code: Select all

document.observe('dom:loaded', function() {
	$('grupo_id').observe('change', function() {
		console.log("change", $F('grupo_id'));
	});
});
But it's not working on a dropdown, I checked de generated HTML but there's no select element, it's just a div and the HTML input "grupo_id" generated by appgini it's an input hidden element so by javascript rules it will not trigger a change event, someone else is having the same problem?

udayvatturi
AppGini Super Hero
AppGini Super Hero
Posts: 85
Joined: 2014-06-14 03:08
Location: India
Contact:

Re: Dropdown on Change event

Post by udayvatturi » 2015-08-18 06:04

Code for tablename-dv.js file

Code: Select all

 jQuery( document ).ready(function( $ ) {

 //certification is dropdown here.below 'change' event called when dropdown is selected/changed.

  jQuery('#certification-container').change(function(){ 

   var cnt=document.getElementById('certification').value;//dropdown selected/changed value
   alert(cnt); // alerts the selected/changed dropdown value

  });

 /* or  if above not works (rare case)*/

 	jQuery("#certification-container").on('change',function(){
			var cnt=$(this).val();
                        alert(cnt);
        });

});

scampollo
Posts: 6
Joined: 2014-07-02 16:33

Re: Dropdown on Change event

Post by scampollo » 2015-08-19 22:44

Thank you very much that's exactly I was looking for. Works perfect!

Post Reply