vitor Posted March 21, 2012 Share Posted March 21, 2012 Hi guys, 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 Link to comment Share on other sites More sharing options...
vitor Posted March 22, 2012 Author Share Posted March 22, 2012 Ok, I've managed to resolve this using the Module Fieldtype Select (AKA Drop Down) here: this way I just created a new Select field and add the required options. Thanks guys for the Module. Best Link to comment Share on other sites More sharing options...
ryan Posted March 22, 2012 Share Posted March 22, 2012 Thanks for the follow-up on the solution you found for this. Link to comment Share on other sites More sharing options...
bitmatix Posted August 18, 2012 Share Posted August 18, 2012 Hi guys, 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!!! Link to comment Share on other sites More sharing options...
slkwrm Posted August 18, 2012 Share Posted August 18, 2012 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. Link to comment Share on other sites More sharing options...
bitmatix Posted August 20, 2012 Share Posted August 20, 2012 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? Link to comment Share on other sites More sharing options...
slkwrm Posted August 23, 2012 Share Posted August 23, 2012 bitmax, not sure what you mean Could you explain in more detail? Link to comment Share on other sites More sharing options...
bitmatix Posted August 26, 2012 Share Posted August 26, 2012 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. Link to comment Share on other sites More sharing options...
Soma Posted August 26, 2012 Share Posted August 26, 2012 Still really hard to understand what your need is. Studying your posts and code I think you are having a page with fields you output as as form on frontend, and one is a page field that will generate a select menu? Now you want to add class="span4" to all inputfields and also to the select menu or only to the option tags? 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? Link to comment Share on other sites More sharing options...
bitmatix Posted August 26, 2012 Share Posted August 26, 2012 @Soma: Thank you for your fast replay! I'm using a (own) modified version of the FormTemplateProcessor module and my code looks almost the same as in the original module. I want to add the "class" attribute to the "select" tag, not to the "option" tags. Link to comment Share on other sites More sharing options...
Soma Posted August 26, 2012 Share Posted August 26, 2012 It's not possible in a convenient way, because the page field is special and not working the same as a text field. It has it's own method of adding the inputfield. So a check would be needed to look for if the inputfield is of type InputfieldPage and then do different code to set attribute for it's inputfield. But since the methods in the InputfieldPage are protected it isn't possible to do the following example: 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. 1 Link to comment Share on other sites More sharing options...
ryan Posted August 27, 2012 Share Posted August 27, 2012 I've just made that function public, so should appear in the source shortly. But I'm thinking Soma's jQuery solution seems like a pretty great one. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now