Formbuilder syntax problem

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
pierrepercee
Forum Members
Forum Members
Posts: 164
Joined: Thu Jan 10, 2013 8:02 am

Re: Formbuilder syntax problem [solved]

Post 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 ! :)
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: Formbuilder syntax problem

Post 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)
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
pierrepercee
Forum Members
Forum Members
Posts: 164
Joined: Thu Jan 10, 2013 8:02 am

Re: Formbuilder syntax problem

Post 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 ....
pierrepercee
Forum Members
Forum Members
Posts: 164
Joined: Thu Jan 10, 2013 8:02 am

Re: Formbuilder syntax problem

Post 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...
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1800
Joined: Wed Feb 25, 2009 4:25 am

Re: Formbuilder syntax problem

Post 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.
Not getting the answer you need? CMSMS support options
pierrepercee
Forum Members
Forum Members
Posts: 164
Joined: Thu Jan 10, 2013 8:02 am

Re: Formbuilder syntax problem

Post 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). :(
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1800
Joined: Wed Feb 25, 2009 4:25 am

Re: Formbuilder syntax problem

Post 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=
Not getting the answer you need? CMSMS support options
pierrepercee
Forum Members
Forum Members
Posts: 164
Joined: Thu Jan 10, 2013 8:02 am

Re: Formbuilder syntax problem

Post 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...
filto
New Member
New Member
Posts: 4
Joined: Fri May 06, 2022 1:40 am

Re: Formbuilder syntax problem

Post 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)
pierrepercee
Forum Members
Forum Members
Posts: 164
Joined: Thu Jan 10, 2013 8:02 am

Re: Formbuilder syntax problem

Post 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.
filto
New Member
New Member
Posts: 4
Joined: Fri May 06, 2022 1:40 am

Re: Formbuilder syntax problem

Post 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}>
pierrepercee
Forum Members
Forum Members
Posts: 164
Joined: Thu Jan 10, 2013 8:02 am

Re: Formbuilder syntax problem

Post by pierrepercee »

value being an array value[0] does the trick...OK :)
pierrepercee
Forum Members
Forum Members
Posts: 164
Joined: Thu Jan 10, 2013 8:02 am

Re: Formbuilder syntax problem

Post 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 !!!
pierrepercee
Forum Members
Forum Members
Posts: 164
Joined: Thu Jan 10, 2013 8:02 am

Re: Formbuilder syntax problem

Post 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 :)
filto
New Member
New Member
Posts: 4
Joined: Fri May 06, 2022 1:40 am

Re: Formbuilder syntax problem

Post 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
Post Reply

Return to “Modules/Add-Ons”