Page 1 of 1
pop up alert on check box
Posted: 18 Apr 2017
by jpwallace
Morning guys,
I have set up my form so that an alert pops up when I check a Void/Cancel check box.....
fd.field('Void/cancel').change(function() {
alert ('my alert');
});
The problem is that it also issues the alert when I uncheck the box, what am I missing so that the alert only appears when I check the void/cancel box
Cheers
Re: pop up alert on check box
Posted: 18 Apr 2017
by Dmitry Kozlov
Hi,
Check the field value in the handler:
Code: Select all
fd.field('Void/cancel').change(function() {
if (fd.field('Void/cancel').value()) {
alert ('my alert');
}
});
Re: pop up alert on check box
Posted: 25 Apr 2017
by jpwallace
Hi Dmitry,
Following on from this, I changed my form to a check box and for the alert to appear if the check box is ticked. I used....
function setExtendedreasons() {
if (fd.field('Extended').value() =='1') {
$('.Extendedreasons').show();
alert ('You have extended the due date for this task. Please insert your comments in the narrative section under the Task Progress tab.');
} else {
$('.Extendedreasons').hide();
}
}
fd.field('Extended').change(setExtendedreasons);
setExtendedreasons();
The issue I have is that when the form is closed and then reopened the alert pops up before the form opens, what do I need to change in order for the alert to appear just when the box is ticked and not when the form opens??
Many thanks
Re: pop up alert on check box
Posted: 25 Apr 2017
by Dmitry Kozlov
Remove call of the setExtendedreasons on loading the form (last line).
Re: pop up alert on check box
Posted: 25 Apr 2017
by jpwallace
Fantastic, works a treat, thank you