class="required" required aria-required="true"
jQuery('#jform_profilecmd01_neworg').change(function () {
if($this).is(':checked') {
$('#jform_profilecmd01_customorg').removeAttr('required');
} else {
$('#jform_profilecmd01_customorg').attr('required');
}
});
<fieldset id="profilecmd01_main"> <legend>Parish, School, Organization, Arch/Diocese</legend> <div class="control-group"> <div class="control-label"> <label id="jform_profilecmd01_customorg-lbl" for="jform_profilecmd01_customorg" class="hasTooltip required" title="<strong>Parish, School, Organization, Arch/Diocese</strong><br />Select your parish/organization from the list. If you parish/organization is not listed, please complete the fields below"> Parish, School, Organization, Arch/Diocese<span class="star"> *</span>
</label>
</div> <div class="controls"> <select id="jform_profilecmd01_customorg" name="jform[profilecmd01][customorg]" class="required" size="10" required aria-required="true"> <option value="">Please locate and select your parish/organization</option> <option value="zzz">My Parish/organization is not listed (I have already looked through the entire list)</option>
...etc
(You can view the actual page on the test site here: http://cmdtest.developmentsite.net/index.php/register-test)
I can't find any documentation specific to Joomla to help me, and nothing that I can find that is general (js/jquery) doesn't seem to work.
Anyone have any ideas or some sample code that you've written before that does this type of thing that you could share?
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.
jQuery("#jform_profilecmd01_neworg").on('click', function(){
jQuery("fieldset#profilecmd01_neworg").toggle();
if(jQuery('#jform_profilecmd01_neworg').is(':checked')) {
jQuery('#jform_profilecmd01_customorg').removeAttr('required');
} else {
jQuery('#jform_profilecmd01_customorg').attr('required');
}
});
However, neither seem to have any effect on the field.
I wish I knew of any extension that did this so that I could just take a look at that code.
If you have any code that does this (check-box requires/un-requires a field) please share the code.
Thanks
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.6081 / Virus Database: 4392/10300 - Release Date: 07/24/15
and
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.6081 / Virus Database: 4392/10305 - Release Date: 07/25/15
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.6081 / Virus Database: 4392/10312 - Release Date: 07/26/15
jQuery('jform_profilecmd01_customorg').addClass('required');
<select id="jform_profilecmd01_customorg" class="required" size="10" name="jform[profilecmd01][customorg]" aria-required="true" required="required">
<select id="jform_profilecmd01_customorg" class="" size="10" name="jform[profilecmd01][customorg]" aria-required="true" required="required">
<select id="jform_profilecmd01_customorg" class="invalid" size="10" name="jform[profilecmd01][customorg]" aria-required="true" required="required" aria-invalid="true">
jQuery(document).ready(function()
{
//set initial parish selector required
//set the 'functional' requirements by adding the required class
jQuery("#jform_profilecmd01_customorg").addClass("required");
//new org items
jQuery("fieldset#profilecmd01_neworg").hide();
//new master org items
jQuery("fieldset#profilecmd01_newmaster").hide();
// handle the 'my org not listed' checkbox
jQuery("#jform_profilecmd01_neworg").on('click', function()
{
jQuery("fieldset#profilecmd01_neworg").toggle();
jQuery("#jform_profilecmd01_customorg").toggleClass("required");
if(jQuery('#jform_profilecmd01_neworg').is(':checked')) {
jQuery('#jform_profilecmd01_customorg').removeClass('required');
jQuery('#jform_profilecmd01_customorg').attr("aria-required","false");
jQuery('#jform_profilecmd01_customorg').prop("required",false);
} else {
jQuery('#jform_profilecmd01_customorg').toggleClass('required');
jQuery('#jform_profilecmd01_customorg').attr("aria-required","true");
jQuery('#jform_profilecmd01_customorg').prop('required',true);
}
});
//handle the 'my master org not listed' checkbox
jQuery("#jform_profilecmd01_newmasterorg").on('click', function()
{
jQuery("fieldset#profilecmd01_newmaster").toggle();
});
});