[TYPO3-english] Formhandler: How to create chained select boxes?

G.Unger skyfreak1 at gmx.net
Sun Jan 24 16:17:31 CET 2010


have sth similar here as a task

select, when option is 'Infomaterial' show additional checkboxes with 
different brochures.

I am still using maiformplus, but should work with formhandler as well IMHO.
the solution a.t.m. is jquery.

eg. sth like this in TS setup

******************
tmp.js-formfield-dependency = TEXT
tmp.js-formfield-dependency.value (

<script src="YrPathToJquery/jquery-1.2.3.pack.js" 
type="text/javascript"></script>
<script type="text/javascript">

$(document).ready(function(){

  $("#checkboxes-wrap").hide();
	
  $("#subject").change(function () {
    var currentVal = $(this).val();
    if (currentVal == 'Infomaterial') {
      $('#checkboxes-wrap').show();
    }
    else {
      $('#checkboxes-wrap').hide();
    }
  })
  .change();
});
</script>


)


page.headerData.900 < tmp.js-formfield-dependency
******************

check the ids and values in the snippet
- #checkboxes-wrap is the id of a wrapper-div around the additional 
checkboxes to be shown, in order to hide them first
- #subject is the id of the select with currentval in my case beeing 
'Infomaterial' the value of the select

that workz so far, now I am playing around with validation and errorchecking.

interesting for you may as well be a combination with this plugin:
http://www.jgeppert.com/jquery-doubleselect/

rgds,
guido









More information about the TYPO3-english mailing list