Jump to content

Fieldtype "Select Options" and "FormTemplateProcessor"


DV-JF
 Share

Recommended Posts

Hello,

I'm trying to get FormTemplateProcessor work with the fieldtype "Select Options". 

The problem is that FormTemplateProcessor takes the name of the field and sends this information via email.

$value = htmlentities($this->contact->get($field->name));

No problem for all other fields, but when it comes to the "Select Options Field" only the ID's were send via mail.

Is there a way to send the title instead of the ID? I've got no ideas - some hints are welcome :-)

Many greets, Jens alias DV-JF.

Link to comment
Share on other sites

You are using the wrong Api for Fieldtype Select Options. Read the docs:

How to handle Fieldtype Select Options. Read the docs:
https://processwire.com/api/modules/select-options-fieldtype/#outputting-selected-options-on-a-page
or
https://processwire.com/talk/topic/11615-select-options-classes-based-on-selections

$optionsfield // return id (string)
$optionsfield->id; // return id (int)
$optionsfield->title; // return string USE THIS or
$optionsfield->value; // return empty string or value (if your option settings like '1=value|title')

Edit: Sorry. Didn't read your post carefully. Form Template Processor is a very old module which doesn't take care about subfields or fields with multiple values. You have to make some changes to this module. Maybe the ProModule FormBuilder could be your solution.

As a starting point to adapt Form Template Processor have a look at this topic:
https://processwire.com/talk/topic/11733-how-to-get-subfields-or-properties-if-fieldtype-is-unknown-helpful-snippet/

I am using a derivation of FormTemplateProcessor which creates Pages from the submitted stuff which works proper with any kind of fieldtype

Edited by kixe
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...