Conditional from a check box to other input field

New Here ,
Jan 20, 2021 Jan 20, 2021

Copy link to clipboard


Not sure if that is the rigth title for this.. but is something like what I need to do, but I'm completely new on this and have low knowledge on JS, so I hope you can help..  this is the matter.. 

I have the following form (also attached)


And what I need is..  On the values for "dias a disfrutar" which are 3 boxes.. be related to the checkbox above of "Dias de vacaciones" So, if I checked the option "15 días" I need that the boxes of "dias a disfrutar"doesn't allowme to input more than 15 days.. and if I select "18 dias" let me put no more than the 18 and so the same for 21..  I have no idea where to put the code or how to code it.. I saw a few topics in the group and found some codes related but nothing that I can use.. So I collected something like the code below.. but I'm not sure if I can use or not or how to use it LOL!


var diasDeVacacionesJunior = 15;

var diasDeVacacionesSenior = 18;

var diasDeVacacionesEjecutivo = 21;

var diasAcumulados = 0;​​​​​

var diasADisfrutar1 = "input field";

var diasADisfrutar2 = "input field;

var diasADisfrutar3 = "input field";


if ( diasAcumulados + diasADisfrutar.value >  diasDeVacacionesJunior) {​​​​​

event.value = 0;

// Show a message that's not possible

return false;

}​​​​​ else {​​​​​

// Let it move forward

diasAcumulados += event.value;

return true;



How to, JavaScript, PDF forms







Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation