Jump to content

Search the Community

Showing results for tags 'inputfieldpage'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 4 results

  1. Hello, in a project I use the multi-instance feature of ProcessWire to get content from another ProcessWire instance which is kind of a "database". I do not modify the external content. For a slider I want to store references to the "database" in an InputfieldPage. To get the available pages I use the following code in my ready.php: $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'kub_highlight_artworks') { // Server path to the PW installation $path = '/var/www/vhosts/.../'; // The root URL for the PW installation $url = 'https://.../'; // Create a new ProcessWire instance $db = new ProcessWire($path, $url); $event->return = $db->pages->find("template=artwork, sort=title"); } }); Outputting and selecting the external pages works perfectly fine, but unfortunately the selected pages do not get saved when I save the page. Can someone point me into the right direction how to make this work? Are there any internal checks whether the page exists in the current instance that prevent saving the values? Best, Flo
  2. I have a Page field with no restrictions on selection, set to use Page Autocomplete. Administrators need to be able to select the home page just like any other. When they type "Home" into the field, the home page appears as an option, but when it is selected, nothing happens. There aren't any javascript errors, and other pages can be added as expected. I do notice in the AJAX call to get the menu results there is a query param "id>0" but "Home" does appear in the list, it just can't be selected. Page Autocomplete is the only practical UI option due to the large (over 6k and growing) number of pages in the site. Has anyone else seen this behavior? Is this a bug or am I missing something in the configuration? This is on PW 2.7.3.
  3. Hey, I am trying to create a template with a field with the type page from a module using the API. This is some of the code I use to generate the field and the template. The field $mvc_register_field = $this->fields->get('mvc_register_page_id'); if(!$mvc_register_field->id){ $mvc_register_field = new Field(); $mvc_register_field->name = 'mvc_register_page_id'; $mvc_register_field->label = 'MVC Register Page ID'; $mvc_register_field->description = 'Checkbox that enables MVC for a page'; $mvc_register_field->type = 'FieldtypePage'; $mvc_register_field->save(); } And the template if(!$this->templates->mvc_register){ $t = new Template(); $t->name = 'mvc_register'; $fieldgroup = $this->fieldgroups->get($t->name); if(!$fieldgroup->id){ $fieldgroup = new Fieldgroup(); $fieldgroup->name = $t->name; $fieldgroup->add($this->fields->get('mvc_register_page_id')); $fieldgroup->save(); } $t->fieldgroup = $fieldgroup; $t->roles = array($this->roles->get('superuser')->id); $t->save(); } And this is how i try to create a page $controller_registry = new Page(); $controller_registry->template = $this->templates->get('mvc_register'); $controller_registry->parent = $this->pages->get("name=" . self::PAGE_NAME); $controller_registry->title = $controller_name; $controller_registry->name = $controller_name; $controller_registry->mvc_register_page_id = $this->pages->get('url=page_url'); $controller_registry->save(); Which gives me this error: How do I resolve this?
  4. Hi all, Hope for a helpful hint and thank you in advance. I am trying to create a form in the frontend with custom markup for the form and the fields. Its all fine, except that I cant find out 1. how to remove the empty "<option></option>" choice and 2. I was wandering if there is a smarter way of making one of the options "selected" in page field using select inputfield. Here is my code: $newPage = new Page(); $newPage->template = 'my_weather'; $field = $fields->get('temp_units'); $inputfield = $field->getInputfield($newPage); $select = $inputfield->getInputfield(); $options = $select->getOptions(); foreach ($options as $key => $val){ $select->removeOption($key); } foreach ($options as $key => $val){ $attr = ($val == 'kg') ? array('selected' => 'selected') : null; $select->addOption($key, $val, $attr); } echo $select->render(); Of course, I could skip render() and output my markup with the options above instead, but it is a quite large form and I prefer to know if this is the right way of getting things done with the API. Thanks!
  • Create New...