Re: FormBuilder dropdown with data from LISE
Posted: Wed Oct 02, 2019 12:17 pm
Same issue I'm afraid, comes through on the email as 'unspecified'
Content management as it is meant to be
https://forum.cmsmadesimple.org/

Code: Select all
{if $test_field != "" && $test_field != "[unspecified]" }<strong>test_field</strong>: {$test_field}<br />{/if}
{$test_field}
{$fld_36}
{$fld_36_obj->name} = {$fld_36_obj->value}
{$m16e7dfbrp__36}Code: Select all
{* DEFAULT FORM LAYOUT / pure CSS *}
{literal}
<__script__ type="text/javascript">
function fbht(htid)
{
var fbhtc=document.getElementById(htid);
if (fbhtc)
{
if (fbhtc.style.display == 'none')
{
fbhtc.style.display = 'inline';
}
else
{
fbhtc.style.display = 'none';
}
}
}
</__script>
{/literal}
{$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}
{*
{LISECourses assign = junk}
<select class="form-control required" title="Select Item" name="{$actionid}{$test_field->input_id}" id="{$actionid}{$test_field->input_id}">
<option value="z">Select items</option>
{foreach $items as $item}
<option value="{$item->alias}">{$item->title}</option>
{/foreach}
</select>
*}
{LISECourses assign = junk}
<select class="form-control required" title="Select Item" name="{$actionid}{$fld_36->input_id}" id="test_field">
<option value="">Select items</option>
{foreach $items as $item}
<option value="{$item->alias}">{$item->title}</option>
{/foreach}
</select>
{* and now the form itself *}
{$fb_form_start}
<div>{$fb_hidden}</div>
<div{if $css_class != ''} class="{$css_class}"{/if}>
{if $total_pages gt 1}<span>{$title_page_x_of_y}</span>{/if}
{if isset($has_captcha) && $has_captcha == 1}
<div class="captcha">{$graphic_captcha}{$title_captcha}<br />{$input_captcha}</div>
{/if}
<div class="submit">{$prev}{$submit}</div>
</div>
{$fb_form_end}
{/if}
{$fb_form_footer}Code: Select all
{LISECourses assign = junk}
<select class="form-control required" title="Select Item" name="{$actionid}{$fld_36->input_id}" id="test_field">
<option value="">Select items</option>
{foreach $items as $item}
<option value="{$item->alias}">{$item->title}</option>
{/foreach}
</select>Code: Select all
<select class="form-control required" title="Select Item" name="m16e7d" id="test_field">
<option value="">Select items</option>
<option value="a_test">A test</option>
<option value="another-test">Another test</option>
</select>Code: Select all
{* DEFAULT FORM LAYOUT / pure CSS *}
{literal}
<__script__ type="text/javascript">
function fbht(htid)
{
var fbhtc=document.getElementById(htid);
if (fbhtc)
{
if (fbhtc.style.display == 'none')
{
fbhtc.style.display = 'inline';
}
else
{
fbhtc.style.display = 'none';
}
}
}
</__script>
{/literal}
{$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}
{* and now the form itself *}
{$fb_form_start}
<div>{$fb_hidden}</div>
{LISECourses assign = junk}
<select class="form-control required" title="Select Item" name="{$actionid}{$fld_36->input_id}" id="test_field">
<option value="">Select items</option>
{foreach $items as $item}
<option value="{$item->alias}">{$item->title}</option>
{/foreach}
</select>
<div{if $css_class != ''} class="{$css_class}"{/if}>
{if $total_pages gt 1}<span>{$title_page_x_of_y}</span>{/if}
{if isset($has_captcha) && $has_captcha == 1}
<div class="captcha">{$graphic_captcha}{$title_captcha}<br />{$input_captcha}</div>
{/if}
<div class="submit">{$prev}{$submit}</div>
</div>
{$fb_form_end}
{/if}
{$fb_form_footer}name="m16e7d" means the {$actionid} is working but {$fld_36} is probably wrong.Code: Select all
<select class="form-control required" title="Select Item" name="m16e7d" id="test_field">
Code: Select all
<pre>{$test_field|print_r:1}</pre>Code: Select all
<pre>{$fields|print_r:1}</pre>Code: Select all
Array
(
[fbrp__36] => stdClass Object
(
[id] => 36
[display] => 1
[required] => 0
[required_symbol] =>
[css_class] =>
[helptext] =>
[field_helptext_id] => fbrp_ht_36
[valid] => 1
[error] =>
[hide_name] => 0
[has_label] => 1
[needs_div] => 1
[name] => test_field
[input] =>
[logic] =>
[values] =>
[value] =>
[smarty_eval] => 0
[multiple_parts] => 0
[label_parts] => 1
[type] => Text Input
[input_css_id] => test_field
[input_id] => fbrp__36
[alias] => test_field
)
[fbrp__35] => stdClass Object
(
[id] => 35
[display] => 0
[required] => 0
[required_symbol] =>
[css_class] =>
[helptext] =>
[field_helptext_id] => fbrp_ht_35
[valid] => 1
[error] =>
[hide_name] => 0
[has_label] => 1
[needs_div] => 1
[name] => Send results
[input] =>
[logic] =>
[values] =>
[value] =>
[smarty_eval] => 0
[multiple_parts] => 0
[label_parts] => 1
[type] => *Email Results to set Address(es)
[input_css_id] => fbrp__35
[input_id] => fbrp__35
[alias] => send_results
)
)It doesn't really matter unless we need file inputs which FB handles differently. For FB what matters is the field name as that is what tells FB what field is being filled with what value(s). If you defined the input as dropdown in FB there was no easy way to make the options be generated dynamically. This way FB doesn't care how the field value is generated. As you can have custom validation you can even check if the options fall inside the available range of options in case that is critical.johnboyuk1 wrote:But is it filled with 'nothing' as we've created a blank Text Input field?
Plus, those values are the state as the page has loaded - before anything is done with the dropdown selector
Well yes!johnboyuk1 wrote: ... so where am I going wring with this, is FB supposed to replace this value just because we've given them the same names?
Code: Select all
<select class="form-control required" title="Select Item" name="m16e7d" id="test_field">Code: Select all
<select class="form-control required" title="Select Item" name="m16e7dfbrp__36" id="m16e7dfbrp__36">
<option value="" selected="selected">Select items</option>
<option value="a_test">A test</option>
<option value="another-test">Another test</option>
<option value="the_thinking_partnership">The Thinking Partnership</option>
</select>