first run chronoform

fabrice.witkowski758 22 Oct, 2024

hello everyone,

I have a 3 pages form.

On the first run of the form, i need to create a custom id for the db save action.

I loop on the first page and save each value which are entered by the user.

After entering some value, the value are saved via a db save action on the first page when the user loop, or in the next page when he has finished.

The values entered by the user are in the data array and are kept if the user loop ( i save them with a db save action) or go to the next page.

I need to create and custom id to differentiate the users submission. 

to do that, i use the custom php code :

if (empty($this->get('id_devis'))) {
$id_devis = rand(1 ,1000);
}
return $id_devis;

the value is created, but it does'nt follow the other data. When i loop or go to the next page, it's always null. How can i do to make this value persistent ? 

<a href="https://ibb.co/nCzzbhd"><img src="https://i.ibb.co/nCzzbhd/ch1.png" alt="ch1" border="0"></a>

After a clic to the link to loop or to go to the next page, this value is always null. A second clic and a new value for the variable is set.

how to correct this and to have the first set value transmitted?

or should i use the uuid. If it's the case, how to access it?

Max_admin 22 Oct, 2024

why not use a database field with "auto increment" enabled ?

if you need uuid then you can use {str:uuid} as your field value

are you using v8 or v7 ? if possible then please use v8

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
fabrice.witkowski758 22 Oct, 2024

because the user can loop and made other choices. So with the id not null autoincrement, i can't associate 2 or more choices of the user.i'm using v7 because now, i can't upgrade to a pro v8 . 

I'try the {uuid} to see if i can associate two choices of the user. Thanks for the answer.

fabrice.witkowski758 25 Oct, 2024

I have a little other question.

I use this 

$this->data['__cf_token'];

in my form to identify the data save.

The variable is associated with the page? or the buton which is clicked  ? When the user is coming form another page, i have an array here 

            [tokens] => Array
                (
                    [1] => ca278d47-7227-4399-b226-8ed4fd79db5c
                    [2] => e12f8cdb-c905-4f35-9c04-0112b214f277

how to access to the first variable ?

chen i use the uppercode, i only have access to the second 

Max_admin 25 Oct, 2024

You should not use this variable, this is something internal, what are you trying to do ?

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
fabrice.witkowski758 25 Oct, 2024

my form is looping on one page. the user is not connected to the site, but he should make some choices.

 the choices have to be stored in db, then he loop on the same page, and make other choices.

He choose one thing and personalize it, he click on the button "another thing", the form stay on the same page then he choose another thing, when he finish his choices, the data goes on a pdf and the pdf is sent to the admin.

I need a way to differentiates users. 

I have thinked about repeater, but some fields are hidden and show only if some first fields are checked. It don't work fine for me because the number of fields shown can vary.

 

Max_admin 02 Nov, 2024

you may use a multipage form and show fields in later pages based on earlier choices ?

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
You need to login to be able to post a reply.

VPS & Email Hosting 20% discount
hostinger