I have a Listit2 instance running on a web page displaying business offices available for rental. On the details page for each business office has a contact form, so that people can send a request for the actual office, selecting date etc. This works very well.
Now I need to add some user field tags in the form submission, so that when I receive the form. For example I have a user field definition called OfficeID {$item->officeid} and another called OfficeLocation {$item->officelocation}. I want the value of those 2 fields sent to me, when the visitor is submitting the form.
Now, I already have the URL link from where the user is submitting the form, and that works too. But if I could have those 2 user field values sent to me as well, that would be really great!
[SOLVED] Listit2 user created fields in FormBuilder
[SOLVED] Listit2 user created fields in FormBuilder
Last edited by qwalk on Fri Apr 11, 2014 1:44 pm, edited 1 time in total.
Re: Listit2 user created fields in FormBuilder submission
Read the help of FormBuilder:
You can use hidden fields for that.Passing Default Values to Forms
Calguy added a nice feature, which is that you can pass default field values to your form via the module tag. This allows you to have the same form in multiple places, but with different default values. It may not work for more exotic field types, but for fields that have a single value, you can specify like:
{FormBuilder form='my_form' value_FIELDNAME='default_value'}
This will set the field with FIELDNAME to 'default_value'.
This can be problematic, as sometimes field names are unwieldy or contain characters that don't work well with Smarty. So there is an alternative like this:
{FormBuilder form='my_form' value_fldNUMBER='default_value'}
That uses field NUMBER, where NUMBER is the internal FormBuilder field id. You might wonder how you know what that id is. Simply go into the FormBuilder configuration tab, and check "Show Field IDs"
Re: Listit2 user created fields in FormBuilder submission
Thanks a lot.
I created 2 hidden fields (ID's 34 and 35) checked the "Process smarty tags within field", and edited the FormBuilder tag: {FormBuilder form='request-form' value_fld34='{$item->officeid}' value_fld35='{$item->officelocation}'}, and added the 2 new hidden fields, to the mail submission template.
I created 2 hidden fields (ID's 34 and 35) checked the "Process smarty tags within field", and edited the FormBuilder tag: {FormBuilder form='request-form' value_fld34='{$item->officeid}' value_fld35='{$item->officelocation}'}, and added the 2 new hidden fields, to the mail submission template.
Re: [SOLVED] Listit2 user created fields in FormBuilder
If form is rendered with in LI template, you have all same variables available inside FB too, without any kind of variable passing.
So you can test changing this:
{FormBuilder form='request-form' value_fld34='{$item->officeid}' value_fld35='{$item->officelocation}'}
into:
{FormBuilder form='request-form'}
then inside hidden field:
Value (see Advanced Tab if you use Smarty tags) ->
Simply pass value there: {$item->officeid}
This is possible because all variables are in global scope and $item is already initiated by LI
Both ways are valid, just bringing this into your attention.
So you can test changing this:
{FormBuilder form='request-form' value_fld34='{$item->officeid}' value_fld35='{$item->officelocation}'}
into:
{FormBuilder form='request-form'}
then inside hidden field:
Value (see Advanced Tab if you use Smarty tags) ->
Simply pass value there: {$item->officeid}
This is possible because all variables are in global scope and $item is already initiated by LI
Both ways are valid, just bringing this into your attention.
Re: [SOLVED] Listit2 user created fields in FormBuilder
When I use a given value like
{FormBuilder form='request-form' value_fld34='NewValue'}
then field 34 gets converted into an ARRAY.
You have to call it in the mail template like this:
fld_34[0]
The bug has been reported already, but this is a workaround until the next version.
Cheers,
Alex
{FormBuilder form='request-form' value_fld34='NewValue'}
then field 34 gets converted into an ARRAY.
You have to call it in the mail template like this:
fld_34[0]
The bug has been reported already, but this is a workaround until the next version.
Cheers,
Alex