Forums

How can i check if submitted fields are unique

wiva 05 Oct, 2020
Migrating V5 to V7
How can i check if submitted fields are unique
The values in the 15 fields can be entered with 15 dynamic drop-downs
In V5 i did this check in an Event Switcher

How can i do this in V7
Max_admin 06 Oct, 2020
1 Likes
change $form->data to $this->data, and change $form->validation_errors to $this->errors

The variable $v is undefined ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
wiva 07 Oct, 2020
Answer
Thank you Max,
This code below, is working well. Varialbe $v was code pollution, I removed it
// an array of drop-down names:
$dropdowns=array(
$this->data[ip][0][renner],
$this->data[ip][1][renner],
$this->data[ip][2][renner],
$this->data[ip][3][renner],
$this->data[ip][4][renner],
$this->data[ip][5][renner],
$this->data[ip][6][renner],
$this->data[ip][7][renner],
$this->data[ip][8][renner],
$this->data[ip][9][renner],
$this->data[ip][10][renner],
$this->data[ip][11][renner],
$this->data[ip][12][renner],
$this->data[ip][13][renner],
$this->data[ip][14][renner],
);

$dropdowns = array_unique($dropdowns);
if ( count($dropdowns) < 15 ) {
return fail;
Max_admin 07 Oct, 2020
you have this code in a PHP action or what ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
wiva 07 Oct, 2020
1 Likes
I have this code in A PHP action
In advanced settings I have a "Events" with two return events "Success"and "Fail".
In the "Success event" I have de Loop / Save Data
In the fail i have a PHP action with an HTML message and a redirection to the form.submit after 5 seconds delay.
The only problem is that the form is reset and empty. I would prefer the form with the choices right before the submit action.

Max_admin 09 Oct, 2020
the form is empty because you redirect, why do you redirect to the submit page ? your fields are in the start_page, yes ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
wiva 09 Oct, 2020
That makes no difference because in the load page i a Read_Data action for data from an eventual previous submitted form.
If there is no previous data in the table the form will be empty.
You need to login to be able to post a reply.