Search the Community
Showing results for tags 'form field'.
-
I've added a hook after the '"ProcessPageEdit::buildFormContent" event. I've added a new config option to the language settings: public function beforeAdminProcessPageEditBuildFormContent (HookEvent $event) { $editPage = $this->getPage(wire('input')->get('id')); if ($editPage->template->name == 'language') { // only add field when editing language page $field = wire('modules')->get('InputfieldText'); $field->attr('name+id', 'locale'); $field->label = __('Locale'); $event->return->insertAfter($field, $event->return->getChildByName('title')); } } I've also created a field (Setup > Fields > Add new) which I've also named 'locale'. The field is displayed, but the value isn't saved when I click the save button. How do I make sure the input of the field is saved as well? And how can I access the stored value once it's saved?
-
Hello, I'm trying to add a custom description to my formfield $serverField = $modules->get("InputfieldText"); $serverField->label = "Server Name"; $serverField->attr("id+name","servername"); $serverField->attr("value",$prefillServer); $serverField->attr("class","form-control"); $serverField->description("description","Desc");// need right syntax here. Or is the method missing $serverForm->append($serverField); I get an error: Method InputfieldText::description does not exist I looked at InputfieldText.module and there is no method for adding a description. Shouldn't there be one? Couldn't find anything in the API cheatsheet that would let me do that. How would I then go about adding a description to a form field?