HowTo set in FormBuilder input-hidden=UDT-value ?
HowTo set in FormBuilder input-hidden=UDT-value ?
Hello,
please how can I assign UDT-value to input-hidden field in FormBuilder before form submission by the user ?
Thanks
please how can I assign UDT-value to input-hidden field in FormBuilder before form submission by the user ?
Thanks
-
uniqu3
Re: HowTo set in FormBuilder input-hidden=UDT-value ?
you can insert a value for a field by using value_fld* parameter (see FormBuilder help), so for example you could call your form {FormBuilder form='my_form' value_fldIDOFTHEFIELD=$your_udt_output_variable}
Re: HowTo set in FormBuilder input-hidden=UDT-value ?
Thanks, it works although I had different declaration :
{FormBuilder form='sp_Fusion' value_sp_username={logged_user_name}}
{FormBuilder form='sp_Fusion' value_sp_username={logged_user_name}}
Re: HowTo set in FormBuilder input-hidden=UDT-value ?
Unfortunately there is still a problem to save this data as a string in db..
I have this declaration :
{FormBuilder form='sp_Fusion' value_sp_username={logged_user_name}}
which produces this html :
<input id="fbrp__52" type="hidden" value="coni_FEU2" name="mc41d9fbrp__52">
and problem appears after submitting the form :
Warning: strlen() expects parameter 1 to be string, array given in /customers/9/e/e/lbi-archpro.org/httpd.www/als-filtering/modules/FormBuilder/classes/DispositionFormBrowser.class.php on line 284 Warning: htmlspecialchars() expects parameter 1 to be string, array given in /customers/9/e/e/lbi-archpro.org/httpd.www/als-filtering/modules/FormBuilder/classes/Form.class.php on line 2519
I don't understand why is apparently string value converted to array ??
I have this declaration :
{FormBuilder form='sp_Fusion' value_sp_username={logged_user_name}}
which produces this html :
<input id="fbrp__52" type="hidden" value="coni_FEU2" name="mc41d9fbrp__52">
and problem appears after submitting the form :
Warning: strlen() expects parameter 1 to be string, array given in /customers/9/e/e/lbi-archpro.org/httpd.www/als-filtering/modules/FormBuilder/classes/DispositionFormBrowser.class.php on line 284 Warning: htmlspecialchars() expects parameter 1 to be string, array given in /customers/9/e/e/lbi-archpro.org/httpd.www/als-filtering/modules/FormBuilder/classes/Form.class.php on line 2519
I don't understand why is apparently string value converted to array ??
Re: HowTo set in FormBuilder input-hidden=UDT-value ?
Try assigning the username to a var before the formbuilder tag or if you are using CustomContent:
I have also found in the past that FB is a bit quirky about field id vs field name. I always use the field id to be sure when setting default values in the FB tag.
Code: Select all
{FormBuilder form='sp_Fusion' value_sp_username=ccUser::username()}Re: HowTo set in FormBuilder input-hidden=UDT-value ?
And don't know if it's related but make sure you do NOT use Fb 0.7.4
http://forum.cmsmadesimple.org/viewtopi ... 64#p308864
As you say the output is I don't think that you need to assign to a variable first.
http://forum.cmsmadesimple.org/viewtopi ... 64#p308864
As you say the output is
Code: Select all
<input id="fbrp__52" type="hidden" value="coni_FEU2" name="mc41d9fbrp__52">Re: HowTo set in FormBuilder input-hidden=UDT-value ?
Guys thanks for support, however it seems this problem is bigger than it looks. I've installed FB 0.7.3, no change.. I've set new definition :
but no change still.. I've also tried to call the method directly instead of calling it from UDT but this ended up in error.. So I don't understand how Smarty handles php custom code and how can I use this code :
instead of putting it into UDT and use it directly in page editation ? I could thus avoid using UDT which seems to be a problem for the system to parse as string..
Code: Select all
{FormBuilder form='sp_Fusion' value_fld30={logged_user_name}}Code: Select all
$feu_module = cms_utils::get_module('FrontEndUsers');
$result = $feu_module->LoggedInName();
echo $result;-
faglork
Re: HowTo set in FormBuilder input-hidden=UDT-value ?
I can confirm that: strings get converted to arays. Apparently, the code segment which takes care of the "parameter override" gets executed TWICE, since the generated ARRAY contains the original STRING as items [0] and [1]. BTW, the "variable-to-array-conversion" bug has alredy been reported in the bugtracker. Unresolved so far.
I found a workaround: In the e-mail template, just don't call the field parameter, but the first item of the array, like so:
{if $fld_41 != ""} Value: {$fld_41[0]}{/if}
But I still have a similar problem - I don't use an UDT to hand over the parameter, but a POST parameter which I insert into the module call:
{FormBuilder form='myform' value_fld30=$smarty.post.param1}
which builds a nice form and all ... but the form simply does not get processed on submit. If I put in a static value:
{FormBuilder form='myform' value_fld30='MyValue'}
then I get an identical form which gets processed (apart from the "array bug"). Form HTML code, HTTP headers sent and POST parameters in both cases are IDENTICAL, whether I use $marty.post.param1 or a static value.
I am at my wits end here ... I just don't know where to look. What can prevent a form form getting processed?
Right now, the parameter override in FB is quite useless. Hope we can find a solution, since this prevents a LOT of very nice & simple cross-connections between modules and formbuilder. If it just worked as described in the module help ...
One question: Does someone have a working installation of formbuilder where the parameter override works?
Cheers,
Alex
I found a workaround: In the e-mail template, just don't call the field parameter, but the first item of the array, like so:
{if $fld_41 != ""} Value: {$fld_41[0]}{/if}
But I still have a similar problem - I don't use an UDT to hand over the parameter, but a POST parameter which I insert into the module call:
{FormBuilder form='myform' value_fld30=$smarty.post.param1}
which builds a nice form and all ... but the form simply does not get processed on submit. If I put in a static value:
{FormBuilder form='myform' value_fld30='MyValue'}
then I get an identical form which gets processed (apart from the "array bug"). Form HTML code, HTTP headers sent and POST parameters in both cases are IDENTICAL, whether I use $marty.post.param1 or a static value.
I am at my wits end here ... I just don't know where to look. What can prevent a form form getting processed?
Right now, the parameter override in FB is quite useless. Hope we can find a solution, since this prevents a LOT of very nice & simple cross-connections between modules and formbuilder. If it just worked as described in the module help ...
One question: Does someone have a working installation of formbuilder where the parameter override works?
Cheers,
Alex
-
faglork
Re: HowTo set in FormBuilder input-hidden=UDT-value ?
a) the bug is the same in 0.7.4 and 0.7.3 ...velden wrote:And don't know if it's related but make sure you do NOT use Fb 0.7.4
http://forum.cmsmadesimple.org/viewtopi ... 64#p308864
As you say the output isI don't think that you need to assign to a variable first.Code: Select all
<input id="fbrp__52" type="hidden" value="coni_FEU2" name="mc41d9fbrp__52">
b) if you want to hand over a parameter to the formbuilder module, you *have* to use a variable otherwise you'd have to hardcode each and every possible form.
Cheers,
Alex
-
uniqu3
Re: HowTo set in FormBuilder input-hidden=UDT-value ?
Have you tried using strval on variable, to truly get string returned, even i haven't faced any issues with FB 0.7.3 or earlier when used with value_* parameter, but i do always use ID so value_fldIDNUMBER.
Basically you can try:
or
or you can simply do some logic in your FormBuilder template, inside foreach loop where you check against ID of the field which is supposed to have that variable as value and build input field yourself.
All of this is untested, but hope you figure your way out.
Basically you can try:
Code: Select all
{$set_value = strval($smarty.post.param1)}
{FormBuilder form='myform' value_fld30=$set_value}
Code: Select all
{FormBuilder form='myform' value_fld30=$smarty.post.param1|strval}
Code: Select all
{if $entry->input_id == 'something'}
<!-- example as hidden field -->
{$set_value = $smarty.post.param1} {* <-- if this param is sent via url to form, shouldn't this be "get" ?? *}
<input type="hidden" name="{$actionid}{$field->input_id}" value="{$set_value|default:''}" />
{/if}
{else}
{$entry->input}
{/if}
{* and so on *}
Re: HowTo set in FormBuilder input-hidden=UDT-value ?
Seems to me that the problem is too hard. It should be easy to insert the $param or $params['some-assoc-array-val'] or $_REQUEST['whatever'].
What do you get when in your UDT, you simply print_r($params); die;
What do you get when in your UDT, you simply print_r($params); die;
Re: HowTo set in FormBuilder input-hidden=UDT-value ?
As a comparison, in your UDT, try print_r($_REQUEST), die; and ensure that the outputs are the same.
-
faglork
Re: HowTo set in FormBuilder input-hidden=UDT-value ?
this changes nothinguniqu3 wrote:Have you tried using strval on variable, to truly get string returned, even i haven't faced any issues with FB 0.7.3 or earlier when used with value_* parameter, but i do always use ID so value_fldIDNUMBER.
Basically you can try:Code: Select all
{$set_value = strval($smarty.post.param1)} {FormBuilder form='myform' value_fld30=$set_value}
this makes the form disappear completely.uniqu3 wrote: or
Code: Select all
{FormBuilder form='myform' value_fld30=$smarty.post.param1|strval}
I still have to test the other canges you suggested.
Thanks,
Alex
-
faglork
Re: HowTo set in FormBuilder input-hidden=UDT-value ?
Yes, especially if you consider that this is the method endorsed in the module help ...psy wrote:Seems to me that the problem is too hard. It should be easy to insert the $param or $params['some-assoc-array-val'] or $_REQUEST['whatever'].
Cheers,
Alex
-
faglork
Re: HowTo set in FormBuilder input-hidden=UDT-value ?
Strange ...
when I name the variable the same as the FB field, it works.
Example:
This is how the page containing the form is called:
The FB module call:
{FormBuilder form="anfrage" value_fld41=$smarty.post.mba7f1fbrp__41}
This works! Still has the "ARRAY-Bug", but at least it works.
UNFORTUNATELY, this works only with ONE example. If you have several calls for the form with different parameters, it fails because the fjeld name changes from form to form. The ID stays, but it does not work with the ID
This bugs me a lot.
Alex
when I name the variable the same as the FB field, it works.
Example:
This is how the page containing the form is called:
Code: Select all
<form action="{cms_selflink href='form' }" method="post" name="formular">
<input type="hidden" name="mba7f1fbrp__41" value="Fachpraxis Nr. 1" />
<input type="submit" value="zum Formular" />
</form>{FormBuilder form="anfrage" value_fld41=$smarty.post.mba7f1fbrp__41}
This works! Still has the "ARRAY-Bug", but at least it works.
UNFORTUNATELY, this works only with ONE example. If you have several calls for the form with different parameters, it fails because the fjeld name changes from form to form. The ID stays, but it does not work with the ID
This bugs me a lot.
Alex


