Page 2 of 3

Re: Formbuilder syntax problem [solved]

Posted: Mon Jul 18, 2022 10:53 am
by pierrepercee
Hello,
My bad, I have not seen that you can ad an alias ! But curiously it doesn't work with generated automatic alias. ("Civilités" /{$civilit__s})

Perfect and thanks one more time.
Definitively great job and great support ! :)

Re: Formbuilder syntax problem

Posted: Mon Jul 18, 2022 11:13 am
by Jo Morg
pierrepercee wrote: Mon Jul 18, 2022 10:53 am ("Civilités" /{$civilit__s})
That would be Civilités = {$civilites} :) only the spaces are replaced by underscores, and diacritics are just removed or, if you will, replaced by their correspondent base character. Just as a note if the alias conflicts with the auto generated one, it won't break but you'll have one less option to use... in most cases, as I use hardcoded labels for the fields or use Eridu to translate them, I tend to just name the fields as if it was an alias to begin with. I rarely, if ever, use the automated form template, which is there only for convenience anyway.
Happy coding! 8)

Re: Formbuilder syntax problem

Posted: Fri Jul 22, 2022 1:24 am
by pierrepercee
Thanks !

I just spent a few hours on it, it works quite well. My last problem, if I have an error in my form and the form is not sent, I am told the error, however I lose all the data already entered.
I found a javascript error which I solved. I went to look in the database for the "inline" parameter, but it's not that.
I created another test form with only 2 fields: first and last name - only the last name is required. As a result, it does not keep the first name when I return to the form.
It's necessarily perfectly stupid ....

Re: Formbuilder syntax problem

Posted: Sat Jul 23, 2022 9:01 am
by pierrepercee
I am a complete idiot. In my templates my fields being defined statically, it is quite normal that they do not include any parameter passed in post. Morality: stop being lazy and work on the initial template with the foreach. Damn where is the exit door...

Re: Formbuilder syntax problem

Posted: Sat Jul 23, 2022 1:24 pm
by DIGI3
the responses will be there, it's perfectly reasonable to not use foreach in the template. If you're unsure, just remember that |print_r will echo the array, so you can see what's available. Try it with one of the fields after a submission and you'll see the value is there.

Re: Formbuilder syntax problem

Posted: Sun Jul 24, 2022 12:46 am
by pierrepercee
Hello Digi3,

I probably misunderstood, my English is very basic... I added a "print_r" to a static field (outside the foreach loop) in my form template. Then I filled in my form, taking care to forget to fill in another required field so that the validation failed. So I have my page with my list of errors and my different fields. For the one with a print_r , I do retrieve the array of available variables but I do not retrieve the value of the field previously filled in (before submission). :(

Re: Formbuilder syntax problem

Posted: Sun Jul 24, 2022 12:48 am
by DIGI3
try {get_template_vars} then. It's been a while since I've created a formbuilder template, but there is something available that you can use in value=

Re: Formbuilder syntax problem

Posted: Sun Jul 24, 2022 11:55 am
by pierrepercee
Hello,

This does not work and it disrupts the functioning of the form. Only the fields placed before the statement are loaded and the css formatting is skipped. I don't have access to any data...

Re: Formbuilder syntax problem

Posted: Mon Jul 25, 2022 4:54 am
by filto

Code: Select all

{$entry->value}  // is default or submited value

{if $fb_form_done == 1}{$entry->value}{/if}   // is only submited value
But i think you’re complicating your task
as Jo Morg have said, working with aliases is easier (non repetitive code) and more flexible
you will not be able to maintain like this a form with a hundred fields

I can try to help you in french by mail if you want

note to dev team : (in DEFAULT FORM LAYOUT) there is an ouptup html error code if you set alias...
LABEL attribut FOR is still $entry->input_id
but $entry->input generates attribut ID to $entry->alias (missmatch)

Re: Formbuilder syntax problem

Posted: Tue Jul 26, 2022 4:48 pm
by pierrepercee
Many thanks Filto,

It works like a charm. Well there are two things left to deal with.
For the mail field (champ du mail from adress) it returns "array"
Print_r gives

Code: Select all

 [input] => [logic] => [values] => [value] => Array ( [0] => la@fe.com 
An I have a checkbox for RGPD, Oddly if I look at the value with a print_r, it's the correct one: checked. But the checkbox does not appear checked after submitting the form with at least one missing field not filled in.

Re: Formbuilder syntax problem

Posted: Wed Jul 27, 2022 1:06 am
by filto
For the mail field you will get the value wtih :

Code: Select all

{$entry->value[0]}
For RGPD checkbox it depends on what you have set in parameter : Value when checked (Valeur cochée)

by default in french this parameter is set to : Coché

then you can use it like this in your input :

Code: Select all

<input ......  {if $entry->value == 'Coché'}checked{/if}>

Re: Formbuilder syntax problem

Posted: Wed Jul 27, 2022 1:13 pm
by pierrepercee
value being an array value[0] does the trick...OK :)

Re: Formbuilder syntax problem

Posted: Wed Jul 27, 2022 11:36 pm
by pierrepercee
Hello Fito,

Many many thanks. "J'avais touvé"" for $entry->value[] , it's not very difficult. I didn't see your answer I think, well at first. Thanks for the GDPR syntax, I'll put that in place. My bootsrap form is perfect and especially thanks to you, Joe Morg and Digi 3, I can now make a decent form with little effort for any css grid :)
MERCI !!!

Re: Formbuilder syntax problem

Posted: Fri Jul 29, 2022 4:13 pm
by pierrepercee
Hello,

$captcha_error is returned if the text differs from the image or if the captcha field is empty.
I don't know the syntax to test the captcha field value. I would like to do something like

Code: Select all

{if $captcha->value == ""} Sorry, the captcha field is empty{elseif isset($captcha_error) && $captcha_error}{$captcha_error}{/if}
I did a few tests, especially with the name of the field

Code: Select all

{$cntnt01fbrp_captcha_phrase->value}
but ...

If anyone knows how to access the captcha text field value :)

Re: Formbuilder syntax problem

Posted: Fri Jul 29, 2022 10:07 pm
by filto
The value is validated internally by the module
depending on the chosen captcha method (Hn, php, recaptcha)

Unless I'm mistaken, you will not have easy access to the value entered by the user
it is not assigned to smarty in the template...

The only easy solution I see is to force the user to fill the field with the required attribute
(in fact, this should be the case by default)

To do this with the basic syntax :

Code: Select all

{$input_captcha|replace:'input':'input required'}
I'm sorry I’m not able to give you more help on this point