13 Posts
smivan85
8 years ago
Topic

Hi all!
I want to create multiple manual checks (validation) on the value of variables or fields.

For example, the user entered bad data: the "submit" button displays an error: "What are you doing!!?".
Grateful for the help!

Get a Book for SEBLOD
4229 Posts
Kadministrator
8 years ago
0
Level 1

If you would like to create additional validations you will need to code that in javascript and attach to onclick event of your submit button.

13 Posts
smivan85
8 years ago
0
Level 1

Hi!

I had to hide several of the buttons on the condition. Here is the solution.

On the form there is a div, created in "core"-"div". The attributes specified in the text: id="div_butt_save".
In this div there are buttons: "Save", "Save and close"...
And this code:

/*Stuff -> Script (JS)*/
...onclick:
function fun1() {
a=document.getElementById("select_firms").value;   /*core 42 - handmade "!select" with multiple "if...", dont work save to database. */
document.getElementById("firms").value = a;   /*For this reason, the value is passed to a standard "firms" (simple select) */
if (a=="") {   /*if the user does not check the value, this code will rip the user's eyes...*/
document.getElementById("div_butt_save").style.visibility='hidden';
} else {
document.getElementById("div_butt_save").style.visibility='visible';
}
};

Sorry for mistakes, I'm not a robot, I learn.

Thanks!

Get a Book for SEBLOD