Page 1 of 1

Form Builder template problems [solved]

Posted: Thu Sep 03, 2015 3:47 pm
by douglas1438
Hi all,

This is an extension of my previous request for help and is quite frankly driving me mad.

I completed a site a few months ago using my a custom Form Builder / Bootstrap template which works perfectly. I've copied and pasted the template to a new site and it doesn't work!

All the fields have the same IDs and names, I've tried two different forms both with the same issue. Feel as though i'm missing something obvious but can't put my finger on it.

Have tried referencing fields as both

Code: Select all

{$your_name}
and

Code: Select all

{$fld_30}
.

Form template for functioning form:

Code: Select all

{$fb_form_header}
{if $fb_form_done == 1}
    {* This first section is for displaying submission errors *}
    {if isset($fb_submission_error) && $fb_submission_error}
        <div class="error_message">{$fb_submission_error}</div>
        {if isset($fb_show_submission_errors) && $fb_show_submission_errors}
            <div class="error">
            <ul>
            {foreach from=$fb_submission_error_list item=thisErr}
                <li>{$thisErr}</li>
            {/foreach}
            </ul>
        </div>
        {/if}
    {/if}
{else}


    {* this section is for displaying the form *}
    {* we start with validation errors *}
    {if isset($fb_form_has_validation_errors) && $fb_form_has_validation_errors}
        <div class="error_message">
        <ul>
        {foreach from=$fb_form_validation_errors item=thisErr}
            <li>{$thisErr}</li>
        {/foreach}
        </ul>
        </div>
    {/if}
    {if isset($captcha_error) && $captcha_error}
        <div class="error_message">{$captcha_error}</div>
    {/if}
    
    {$fb_form_start|replace:'form-data"':'form-data" role="form"'}
    <div>{$fb_hidden}</div>


                            



<fieldset>
<div class="row">
<div class="col-md-6">
<p>*Required fields</p>
<div class="form-group">
<label for="{$actionid}{$name->input_id}">Name*</label>
<input class="form-control" type="text" name="{$actionid}{$name->input_id}" id="{$actionid}{$name->input_id}" title="Please enter your name" required="required" />
</div>
<div class="form-group">
    <label for="{$actionid}{$email->input_id}">E-Mail*</label>
    <input class="form-control" type="email" name="{$actionid}{$email->input_id}" id="{$actionid}{$email->input_id}" title="Please enter your email address" required="required"/>
</div>
<div class="form-group">
    <label for="{$actionid}{$telephone->input_id}">Telephone</label><input class="form-control" type="tel" name="{$actionid}{$telephone->input_id}" id="{$actionid}{$telephone->input_id}" title="Please enter your phone number"/>
</div>
                                
<div class="form-group">
   <label for="{$actionid}{$message->input_id}">Message*</label>
   <textarea class="form-control" name="{$actionid}{$message->input_id}" id="{$actionid}{$message->input_id}" rows="5" cols="25" required="required" >
   </textarea>
   </div>
</div>
<div class="col-md-6">
<div class="formcaption"><strong>Your property requirements</strong></div>
<div class="form-group">
    <label for="{$actionid}{$number_of_bedrooms->input_id}">Number of bedrooms</label>
    <input class="form-control" type="text" name="{$actionid}{$number_of_bedrooms->input_id}" id="{$actionid}{$number_of_bedrooms->input_id}" title="Please enter number of bedrooms required" />
</div>
<div class="form-group">
    <label for="{$actionid}{$preferred_location_s_->input_id}">Preferred location(s)</label>
    <input class="form-control" type="text" name="{$actionid}{$preferred_location_s_->input_id}" id="{$actionid}{$preferred_location_s_->input_id}" title="Please enter your preferred location" />
</div>
<div class="form-group">
    <label for="{$actionid}{$how_did_you_find_us_->input_id}">How did you find us?</label>
    <input class="form-control" type="text" name="{$actionid}{$how_did_you_find_us_->input_id}" id="{$actionid}{$how_did_you_find_us_->input_id}" title="Please tell us how you found us" />
</div>
<div class="checkbox contactcheckbox">
    <label for="{$actionid}{$email_me_about_future->input_id}">
    <input type="checkbox" name="{$actionid}{$email_me_about_future->input_id}" id="{$actionid}{$email_me_about_future->input_id}" title="Please tick to be advised about future developments" /> Email me about future developments
</label>
</div>
<div class="form-group contactsubmit">
<!--<label for="{$actionid}_submit"></label>
<input class="btn btn-lg btn-default" type="submit" name="{$actionid}submit" id="{$actionid}submit" value="Send Message" />-->
{$submit}
</div>
</div>
</div>
</fieldset>
{$fb_form_end}
{/if}


Form template that doesn't work, was originally longer but removed fields one by one to see if it was causing an issue.

Code: Select all

{$fb_form_header}
{if $fb_form_done == 1}
    {* This first section is for displaying submission errors *}
    {if isset($fb_submission_error) && $fb_submission_error}
        <div class="error_message">{$fb_submission_error}</div>
        {if isset($fb_show_submission_errors) && $fb_show_submission_errors}
            <div class="error">
            <ul>
            {foreach from=$fb_submission_error_list item=thisErr}
                <li>{$thisErr}</li>
            {/foreach}
            </ul>
        </div>
        {/if}
    {/if}
{else}


    {* this section is for displaying the form *}
    {* we start with validation errors *}
    {if isset($fb_form_has_validation_errors) && $fb_form_has_validation_errors}
        <div class="error_message">
        <ul>
        {foreach from=$fb_form_validation_errors item=thisErr}
            <li>{$thisErr}</li>
        {/foreach}
        </ul>
        </div>
    {/if}
    {if isset($captcha_error) && $captcha_error}
        <div class="error_message">{$captcha_error}</div>
    {/if}
    
    {$fb_form_start|replace:'form-data"':'form-data" role="form"'}
    <div>{$fb_hidden}</div>
<fieldset>
<h3>Firstly we need some details about you</h3>
<small>*Required fields</small>
<div class="form-group">
<label for="{$actionid}{$fld_30->input_id}">Your name *</label>
<input class="form-control" type="text" name="{$actionid}{$fld_30->input_id}" id="{$actionid}{$fld_30->input_id}" title="Please enter your name" required="required" />
</div>
</div>
<div class="form-group">
<label for="{$actionid}{$fld_34->input_id}">Where do you live? *</label>
<input class="form-control" type="text" name="{$actionid}{$fld_34->input_id}" id="{$actionid}{$fld_34->input_id}" title="Enter your location" required="required" />
</div>
<div class="form-group contactsubmit">
<!--<label for="{$actionid}_submit"></label>
<input class="btn btn-lg btn-default" type="submit" name="{$actionid}submit" id="{$actionid}submit" value="Send Message" />-->
{$submit}
</div>
</fieldset>
{$fb_form_end}
{/if}

Re: Form Builder template problems

Posted: Fri Sep 04, 2015 4:00 am
by Jeff
Try putting {get_template_vars} in there to see what variables are defined.

Re: Form Builder template problems

Posted: Fri Sep 04, 2015 5:02 am
by Rolf
What doesnt work?

Re: Form Builder template problems

Posted: Fri Sep 04, 2015 8:19 am
by douglas1438
The issue is the form ids are all the same, not unique as the functional form.

Non working form source:

Code: Select all

<div class="form-group">
<label for="ma80b0">Your name *</label>
<input class="form-control" type="text" name="ma80b0" id="ma80b0" title="Please enter your name" required="required" />
</div>
<div class="form-group">
<label for="ma80b0">Where do you live? *</label>
<input class="form-control" type="text" name="ma80b0" id="ma80b0" title="Enter your location" required="required" />
<small>You must live in the Borough of Colchester to use this service.</small>
</div>
Working source:

Code: Select all

<div class="form-group">
<label for="m4538dfbrp__51">Name*</label>
<input class="form-control" type="text" name="m4538dfbrp__51" id="m4538dfbrp__51" title="Please enter your name" required="required" />
</div>
<div class="form-group">
    <label for="m4538dfbrp__35">E-Mail*</label>
    <input class="form-control" type="email" name="m4538dfbrp__35" id="m4538dfbrp__35" title="Please enter your email address" required="required"/>
</div>

Re: Form Builder template problems

Posted: Fri Sep 04, 2015 5:42 pm
by Jeff

Code: Select all

name="ma80b0"
It isn't working because it doesn't have a field id (this is only the action id to tell which module is connected to) to tell FB what field it is.

Re: Form Builder template problems

Posted: Tue Sep 08, 2015 9:31 am
by douglas1438
The field ID is generated by Form Builder, which wasn't working, in the end I removed and re installed Form Builder now works. My only issue now is my select menus don't give a value, show as unspecified when submitted.

Code: Select all

<select class="form-control" name="{$actionid}{$sex->input_id}" id="{$actionid}{$sex->input_id}">
  <option value=""></option>
  <option value="Male">Male</option>
  <option value="Female">Female</option>
</select>
Shouldn't this just pass the value to Form Builder?