Page 1 of 1

see a POP UP window appear when a field is checked

Posted: 2024-03-07 05:59
by pasbonte
Hello,
I would like to see a POP UP window appear when a field is checked: if yes WINDOW APPEARS with a blah blah text if not the window does not appear, have you already done so?

Thank you

Re: see a POP UP window appear when a field is checked

Posted: 2024-03-07 21:02
by pbottcher
Hi,

not sure if I get your question completely. Do you want to have the popup when the field is checked, or do you want to have the popup when the page is loaded with the field being already checked?

Re: see a POP UP window appear when a field is checked

Posted: 2024-03-09 08:15
by pasbonte
Hello
i have the popup when the field is checked
merci !

Re: see a POP UP window appear when a field is checked

Posted: 2024-03-26 02:48
by peebee
You could try this in your /hooks/tablename-dv.js

For a dropdown - inspect and find your dropdown field #id:

Code: Select all

$j(function() { 
    $j('#your-field-id').on('change', function() {      
      if(jQuery('#your-field-id').val() == 'Yes'){
         alert('Your Alert Here\nThis is a new line in the alert\nThis is another new line'); // popup alert if your selected field is changed to Yes 
         jQuery('#your-field-id').focus();
        }         
    });
});
For radio buttons - you'll need to identify the specific button #id
eg: <input id="your-field-id2" type="radio" name="your-field-id" value="Yes">:

Code: Select all

$j(function() { 
    $j('#your-field-id2').on('change', function() {      
      if(jQuery('#your-field-id2').val() == 'Yes'){
         alert('Your Alert Here\nThis is a new line in the alert\nThis is another new line'); // popup alert if your selected field is changed to Yes 
         jQuery('#your-field-id2').focus();
        }         
    });
});
html formatting won't work in javascript browser alerts but \n will provide a new line if you need one.