marcq
Member
Hi,
I try hard to improve my javascript skills but...
I have created a form with several tabs, in one of my tabs I've got the following elements :
Invoice sent | date element with date picker
Invoice paid | date element with date picker
First reminder | date element without date picker
Button First reminder
Second reminder | date element without date picker
Button Second reminder
Third reminder | date element without date picker
Button Third reminder
Basically, when the user want to send the 1st reminder he click the blue button, is routed to another form which is a prefilled email that he can change if need, when the email is sent the "1er rappel" field is populated with the actual date.
I'm running a javascript script which should do the following :
1. If "Facture expediee" and "Facture acquittee" are empty then all buttons are disabled.
2. If "Facture expediee" is filled with a date and "Facture acquittee" are empty then the blue button is enabled, 1. the orange and red buttons are disabled.
3. If "Facture expediee" is filled with a date and "Facture acquittee" is empty and the "1er rappel" date is filled then the orange button is enabled date the blue and red buttons are disabled
4. If "Facture expediee" is filled with a date and "Facture acquittee" is empty and the "1er rappel" and "@eme rappel" date are not empty then the red button is enabled and the blue and orange buttons are disabled.
I have created the following function, but the script is not working by the third step. Is something wrong with my code ?
Thanks, marc
I try hard to improve my javascript skills but...
I have created a form with several tabs, in one of my tabs I've got the following elements :
Invoice sent | date element with date picker
Invoice paid | date element with date picker
First reminder | date element without date picker
Button First reminder
Second reminder | date element without date picker
Button Second reminder
Third reminder | date element without date picker
Button Third reminder
Basically, when the user want to send the 1st reminder he click the blue button, is routed to another form which is a prefilled email that he can change if need, when the email is sent the "1er rappel" field is populated with the actual date.
I'm running a javascript script which should do the following :
1. If "Facture expediee" and "Facture acquittee" are empty then all buttons are disabled.
2. If "Facture expediee" is filled with a date and "Facture acquittee" are empty then the blue button is enabled, 1. the orange and red buttons are disabled.
3. If "Facture expediee" is filled with a date and "Facture acquittee" is empty and the "1er rappel" date is filled then the orange button is enabled date the blue and red buttons are disabled
4. If "Facture expediee" is filled with a date and "Facture acquittee" is empty and the "1er rappel" and "@eme rappel" date are not empty then the red button is enabled and the blue and orange buttons are disabled.
I have created the following function, but the script is not working by the third step. Is something wrong with my code ?
Code:
function feDisableButtons() {
// GET FORM REFERENCE
var form = Fabrik.getBlock('form_59');
if (form.formElements.get('gprh_fabrik_user_registration_332_repeat___date_envoi_facture_fe').getValue() != '' && form.formElements.get('gprh_fabrik_user_registration_332_repeat___date_facture_acquittee_fe').getValue() == '') {
jQuery('#gprh_fabrik_user_registration_332_repeat___bouton_premier_fe').attr('disabled', false);
jQuery('#gprh_fabrik_user_registration_332_repeat___bouton_second_fe').attr('disabled',true);
jQuery('#gprh_fabrik_user_registration_332_repeat___bouton_troisieme_fe').attr('disabled',true);
} else if (form.formElements.get('gprh_fabrik_user_registration_332_repeat___date_envoi_facture_fe').getValue() != '' && form.formElements.get('gprh_fabrik_user_registration_332_repeat___date_facture_acquittee_fe').getValue() != '') {
jQuery('#gprh_fabrik_user_registration_332_repeat___bouton_premier_fe').attr('disabled', true);
jQuery('#gprh_fabrik_user_registration_332_repeat___bouton_second_fe').attr('disabled',true);
jQuery('#gprh_fabrik_user_registration_332_repeat___bouton_troisieme_fe').attr('disabled',true);
} else if (form.formElements.get('gprh_fabrik_user_registration_332_repeat___date_envoi_facture_fe').getValue() != '' && form.formElements.get('gprh_fabrik_user_registration_332_repeat___date_facture_acquittee_fe').getValue() == '' && form.formElements.get('gprh_fabrik_user_registration_332_repeat___premier_rappel_fe').getValue() != '') {
jQuery('#gprh_fabrik_user_registration_332_repeat___bouton_premier_fe').attr('disabled', true);
jQuery('#gprh_fabrik_user_registration_332_repeat___bouton_second_fe').attr('disabled',false);
jQuery('#gprh_fabrik_user_registration_332_repeat___bouton_troisieme_fe').attr('disabled',true);
} else {
}
};
Thanks, marc