Page 1 of 1

After form validation field content turns into Array

Posted: Fri Sep 06, 2013 12:34 pm
by Vinko
cmsms 1.11.7
Formbuilder 0.7.3

When creating a new form and setting the content of a certain field to a variable, like this:
{FormBuilder form='user_details' value_myname='$some_string'}
I get the following warning message after validation:
Warning: strlen() expects parameter 1 to be string, array given in /home/lenter1q/public_html/tiwaz.nl/modules/FormBuilder/classes/TextField.class.php on line 160

The content of the field changes to Array as well.

It looks like the validation adds the current field value to the value_myname and forms an Array. The field is not editable by the user, but the user must be able to see the field value.

Obviously this is not what I want, I want the field to display the $some_string value again. I hope someone can help.

Re: After form validation field content turns into Array

Posted: Mon Sep 09, 2013 7:50 am
by velden
Not sure if this will solve the problem, but I would remove the quotes around the variable:

Code: Select all

{FormBuilder form='user_details' value_myname=$some_string}
If quotes are required for some reason I'd use the double quotes:

Code: Select all

{FormBuilder form='user_details' value_myname="$some_string"}

Re: After form validation field content turns into Array

Posted: Fri Sep 13, 2013 12:02 pm
by Vinko
Thanks for your reply. Unfortunately it doesn't solve the problem. I'm not sure why I even added quotes here, because I didn't (shouldn't) use them in the code. I removed the option from the form and solved it in an entire other way.