FormTemplateProcessor with Page Fieldtype
#1
Posted 21 March 2012 - 12:14 PM
I'm trying to create a front end form using the FormTemplateProcessor with Page Fieldtype to create some selectable and radio elements, everything is working great,
The only issue I'm having and I've searched everywhere is that, when I submit the form the values from the select and radios on the email sent come as id's and not the title of those pages.
is there any way I could just grab the titles for the select and radio buttons? Or is there any better way to achieve this?
Thanks
#2
Posted 22 March 2012 - 08:48 AM
I've managed to resolve this using the Module Fieldtype Select (AKA Drop Down) here: http://processwire.c...-aka-drop-down/ this way I just created a new Select field and add the required options.
Thanks guys for the Module.
Best
#4
Posted 18 August 2012 - 09:08 AM
I'm trying to build an "advanved search" form depending on the idea of the "FormTemplateProcessor" and i also have some trouble with "InputfieldPage", because I need to modify the options, that appear in the select field. Is there any chance to "filter" the pages, which goes into the "InputfieldPage" before the field gets rendered?
Thanks!!!
#6
Posted 20 August 2012 - 07:55 AM
bitmatix, have a look at your Page field's Input tab and two options on it:
Custom selector to find selectable pages
Custom PHP code to find selectable pages
Cheers.
Thanks a lot slkwrm, that's what I was looking for
Now I have the problem, that I can't set the "class" attribute of the generated "select" tag. It only works for normal textfields. Any idea?
#8
Posted 26 August 2012 - 06:54 AM
bitmax, not sure what you mean
Could you explain in more detail?
I want to do the following:
// get the collection of inputs that can populate this page's fields
$inputfields = $this->page->getInputfields();
foreach ($inputfields as $inputfield) {
$inputfield->setAttribute('class', 'span4');
$form->add($inputfield);
}
It seems like this only works for text inputfields, but not for "InputfieldPage" fields.
#9
Posted 26 August 2012 - 07:11 AM
Are you using the Formtemplate processor module or your own code? How do your full code look or how are you rendering the inputfields and what is the result you desire?
@somartist | modules created | support me, flattr my work flattr.com
#11
Posted 26 August 2012 - 08:15 AM
foreach ($inputfields as $inputfield) {
if($inputfield instanceof InputfieldPage){
$inputfield->getInputfield()->setAttribute('class','span3'); // will fail cause method is protected
} else {
$inputfield->setAttribute('class', 'span4');
}
$form->add($inputfield);
}InputfieldPage.module #101
protected function getInputfield() {If Ryan could make it change to something it could be accessed the above code would work. I don't see any other way right now.
So, for now you could do a regex replace script to parse the returned html string from ->render() before outputting. Not simple if you don't know.
But, here's the most simple way using jQuery.
$('select[id^=Inputfield]').addClass('span4');Voila.
@somartist | modules created | support me, flattr my work flattr.com
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













