Everything works great, but as I receive data from the users, I added a Privacity checkbox, and I am trying to make it mandatory so users can’t send the data unless they accept it, but I am not having much luck.
If I create the field Marc (Checkbox) as mandatory, that doesn’t work.
I added a Custom Script, but I am unable also to make it work.
I have the checkbox value as undefined
This is the code I am using:
frappe.web_form.validate = () => {
value = frappe.web_form.get_value(“Privacidad”);
if (value == 1)
return true;
else
frappe.msgprint("Por favor, acepta la condición de Privacidad);
return false;
};
this happens with every developer, thats ok. happened with me too
(Analogy…) phone was not charging so the entire mobile phone was opened and dissembled because . no-clue why.
Later it was discovered after spending much time and effort that the charging-cable was faulty… and in worst case someone also forgot to switch on the socket altogether.
so always good to start diagnose/debug with basic checks (such as syntax check)
You are right with your analogy , that also happens to me sometimes on my normal job. I repair something and when checking I have to disassemble again to find after some time that I had forgotten to connect a battery, or switch on a fuse…
But I will follow your advice and next time I start with the basic checks!
Hello, this is not working for me. Regardless of whether someone checks the box or not, the person gets a validation error that the box is not checked.
frappe.web_form.validate = () => {
let value = frappe.web_form.get_value(“privacidad”);
let value1 = frappe.web_form.get_value(“permiso”);
if (value == value1 ==1){
return true;
}
else{
frappe.msgprint(“Por favor, tienes que aceptar la condición de Privacidad y darnos permiso para publicar tus comentarios”);
return false;
}
};