[Solved] FormBuilder and using a UDT to provide feedback
Posted: Tue Jul 22, 2014 2:39 pm
Hello (added more info 7/23),
Feeling a little in the dark here so reaching out for help! I have a form set up to receive user input (a zip code). I want to feed that input into a UDT then return the results to the user. I seem to be having trouble getting the input into my UDT.
I have a field setup of type 'Call A User Defined Tag With the Form Results', referencing my UDT. I have my UDT built expecting to access the $params array. How do I get the form to pass the field data to the UDT on submit, then display the results of my UDT?
Currently I have the call to my UDT on the submission template. I have also tried putting it on the same page as the form. Neither gets me the form data passed to the UDT so my UDT ends up displaying 'nothing given to me' but I think this is just because the UDT is being called by the page, not the form.
I seem to be missing a vital piece of understanding in how the form interacts with the UDT and what happens after the submission of the data to the UDT. I have it set for a simple string return so how do I get that string to display?
Thanks
Here is my UDT:
*****************************************************
global $params;
$zipcodes = array(
"85224" => "AZ Chandler",
"85322" => "AZ Arlington",
"85323" => "AZ Tolleson",
"85326" => "AZ Buckeye",
"85335" => "AZ El Mirage",
"85340" => "AZ Litchfield Park"
);
if(!empty($params['zipcode']))
{
if(array_key_exists($params['zipcode'], $zipcodes))
{
return "Yes, we provide coverage in " . $zipcodes[$params['zipcode']] . ". Please fill out the form so we can get in touch with you to setup service.";
}
else
{
return "We do not currently service that area. Please fill out the form to be notified when we expand coverage.";
}
}
else
{
return "Nothing given to me";
}
*****************************************************
Feeling a little in the dark here so reaching out for help! I have a form set up to receive user input (a zip code). I want to feed that input into a UDT then return the results to the user. I seem to be having trouble getting the input into my UDT.
I have a field setup of type 'Call A User Defined Tag With the Form Results', referencing my UDT. I have my UDT built expecting to access the $params array. How do I get the form to pass the field data to the UDT on submit, then display the results of my UDT?
Currently I have the call to my UDT on the submission template. I have also tried putting it on the same page as the form. Neither gets me the form data passed to the UDT so my UDT ends up displaying 'nothing given to me' but I think this is just because the UDT is being called by the page, not the form.
I seem to be missing a vital piece of understanding in how the form interacts with the UDT and what happens after the submission of the data to the UDT. I have it set for a simple string return so how do I get that string to display?
Thanks
Here is my UDT:
*****************************************************
global $params;
$zipcodes = array(
"85224" => "AZ Chandler",
"85322" => "AZ Arlington",
"85323" => "AZ Tolleson",
"85326" => "AZ Buckeye",
"85335" => "AZ El Mirage",
"85340" => "AZ Litchfield Park"
);
if(!empty($params['zipcode']))
{
if(array_key_exists($params['zipcode'], $zipcodes))
{
return "Yes, we provide coverage in " . $zipcodes[$params['zipcode']] . ". Please fill out the form so we can get in touch with you to setup service.";
}
else
{
return "We do not currently service that area. Please fill out the form to be notified when we expand coverage.";
}
}
else
{
return "Nothing given to me";
}
*****************************************************