Jump to content

Search the Community

Showing results for tags 'field'.

  • 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







  1. Hi, I'm trying to figure out if it's possible to add a "field" of some sort to the templates. See, this "field" isn't exactly a like the regular fieldtypes that would have different values depending on the pages that use that template. What I'm looking for is almost exactly the same as the Tags field in the advanced tab of the template settings. My use case scenario is that I want to put some keywords in there that would be available to all the pages using a particular template, and then I could perhaps use those values to determine dependencies, etc. I could actually achieve this with the existing tag field, but then it messes with the templates list because they appear multiple times depending on how many tags I put in them. So my question is how or if it's possible to add another field like it to templates? Thanks.
  2. I have the following selector: wire("pages")->find("template=news|video, parent|secondary_categories=$page, limit=8, sort=-publish_date, sort=title"); parent represents the parent of the current page $page is the object representing the current page secondary_categories is a field assigned to the "news" and "video" templates, it is of type "Page" and it uses ASMSelect for selecting multiple pages So basically, what I'm telling ProcessWire is: "Get me 8 pages that use either the 'news' OR 'video' template, AND that also have the current $page as their parent OR that have a reference to the current $page within their secondary_categories field". The problematic part is: parent|secondary_categories=$page The OR operator is not working - I'm only getting pages where the parent is $page, and none where $page is in secondary_categories.
  3. Hey All. I am trying to change the label of a field after a certain page is saved. This field is not part of the page that is saved but the label should be updated with the page name. $pages->addHookAfter('saved', function($event) { $page = $event->arguments[0]; if($page->template->name == 'service-type') { $cid = $page->id; $this->message($cid); /* find field servicetype_rangeslider_$cid and set label */ // how to access $fields?? } }); I have this hook in my /site/ready.php. Now my remaining problem is, how to access $fields array or in general, how to get the field? I am thankful for every hint, thanks!!
  4. Hey all. I just created a new "Avatar" user-image field in the user-template. Unfortunately, it is only showing in 'Access->Users->user-xyz' and not in 'Wrench-Sign->Profile user-xyz', so on the page http://localhost/testsite/admin/profile/ Does anyone of you know what to change that this new field is also shown in the profile-page? Thanks a lot!
  5. Hey All. I am currently writing a very small module to accomplish the following: - I have a Page "Service Types" with multiple childs "Service Type". Whenever a new "Service Type" is added, a Field (in my case FieldtypeRangeSlider) should be generated, eg "servicetype_communication_rangeslider" and added to an existing template ('case') at a specific position. I have little experience with modules but managed to get it done till the successfull creation of the range-field. But now I am struggeling with adding it to the template. First, I havend managed to get a list of templates in the module..just a workaround via pages and selector template=case. I think this would work, but only of there are pages with this tempalte. If not, this solution fails and in general, I don't know how to get the templates in a module. Second, I have no clue how to add a field at a specific position to an existing template (to an existing Fieldset in my case). Here is my code so far: class AddServiceTypesByPage extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Add ServiceTypes By Page (Didhavn)', 'version' => 1.0, 'summary' => 'Add the ServiceTypes by getting Pages with Template "service-type"', 'singular' => true, 'autoload' => true ); } public function init() { $this->pages->addHookAfter('added', $this, "hookAdded"); } public function ready() { // PW API is ready, Controllers go here } public function hookAdded(HookEvent $event) { $page = $event->object; if (!$page->template) { $page = $event->arguments[0]; } if($page->template == 'service-type') { $f = new Field(); $f->type = $this->modules->get("FieldtypeRangeSlider"); $f->name = 'servicetype_' . $page->name; $f->label = 'Service-Type ' . $page->get('title')->getDefaultValue(); $f->set('suffix','%'); $f->set('tags','servicetype'); $f->set('icon','fa-sliders'); $f->save(); /* * now add the field to existing template with name 'case' */ } } } I am thankfull for any help or suggestion! Thanks a lot!
  6. hi! i'm trying to get the label of my field that i use in two templates with different name. so i'm trying to get the label through the template. so my code is echo $templates->get("home")->fieldgroup->get("text")->label; but it gives me the general field label not that i'm using for the home template any idea?
  7. I was struggling a bit getting all subfields of a field if type is unknown. I made a small function for use in templates which returns an array() of all properties of (maybe any?) pagefieldvalue. If there is something similar in core (which I couldn't find) please let me know. Tested it with Fiedtype Options, Page, ProfieldsTable. Feel free to use it. /** * ProcessWire UsefulSnippets * * How to get all properties, subfields of any field if you don't know the type only if value is set * @return array */ function getProperties($fieldvalue) { // multiple value field if ($fieldvalue instanceof WireArray) { $result = array(); foreach ($fieldvalue as $subfieldvalue) { $result[] = getProperties($subfieldvalue); } return $result; // single value field with subfields } else if ($fieldvalue instanceof WireData) return get_object_vars($fieldvalue->getIterator()); // single value field else return $fieldvalue; } // Example var_dump(getProperties($page->myfield));
  8. Hi Forum, I need to secure some downloads with a simple login form. As login tasks are new to me I try to adapt the code from this forum post for my purposes. This is where I am so far: A page with input field type "password" (name "password"). This code: <?php password protected areaif ($page->password) { $pass = $page->password; if ($input->post->pass != $pass) { echo "$page->body" . file_get_contents("./_login-form.inc"); // not logged in? get input form } else { foreach ($page->downloads as $file) { echo "<h2>Sie sind eingeloggt</h2>"; echo "<ul>" . "<li class='plain'><i class='fa fa-download'></i><a href='$file->url';?> $file->description</a></li>" . "</ul>"; } // foreach } // $input->post} //$page->password?> And for _login-form.inc <form method="post" action="./" accept-charset="UTF-8"> <input type="password" id="pass" name="pass" placeholder="" /> <button type="submit" name="submit" class="btn btn-success btn-block">Login</button></form> Unfortunately the conditional always returns false even if the correct password has been entered into the form. This is the first time I'm using fieldtype password, thus I don't know how to check for the correct password entered (I understand the value is stored encrypted but that's all I know). Any help is much appreciated. Thanks!
  9. Hello, I'm using the multiple images in image field for the gallery setup. There problem is that I can't find how to remove already uploaded images in the image field. There is no remove icon or menu function. Or I just can't find it. How to remove the images? My image field with uploaded images in admin looks like this:
  10. Hi, I have created a post-like structure like this: Page: Posts Page: Category Posts has a field called "category" which is derived from the Category page's children - these children simply have a title field e.g. ("Events", "News" etc) I would like to filter the children of Posts based on this field, something like this: $posts = $pages->get('/posts/')->children("category=events"); However category is a number, in my case Events is the number 1014. Obviously I want to filter by a string instead. How can I do this? Thanks in advance for your help! /////////////////////////////////////// Apologies, after I wrote this I saw a related page at the bottom. Here is the solution for completeness: http://processwire.c...a-selector-tag/ $category = $pages->get("/category/events/"); $posts = $pages->get('/posts/')->children("category=$category"); Nice and easy
  11. It would be great to add limitiations (f.e. output 7 repeats without the possibility to add or to remove a repeat) to the repeater fields (like permanent repeats) This can be used for example for opening hours (output 7 repeats each for one day). The customer has no possibility to delete or add another repeat. The limitations should be placed under the details tab.
  12. Hi there, I need a radio button fieldtype. The checkbox field only allows one value, right? I need a field that displays a list of radio buttons, in which the user has to pick one. Is this available through processwire? How can I do something like this? Thanks in advance
  13. Hello everyone, Been working rough 5-6 months with this beast and i gotta tell you that it's almost perfect Of course every software has it's ups and downs, just like life does and nothing is perfect or meant for everyone, but here we go... I think database structure is about correct and flexible enough, what i don't like is that i can have similar field with 3x different prefix just because i need different control data for that same field. How about if template would control fields data instead of field? Field could have it's own control data as default, but i would really like to see that template could at least control some data, like visibility, appearance, required, stuff like this. Why? Because past 5-6 months i faced fact that for example when i need to custom admin interface for some template i would like to use same field over and over again, but it's kind of impossible when width can be 50%, 33% or 100% for different templates, data how ever is very same. Feels so stupid to create field over and over again, when it could use existing database tables. You already have control tables for fields and data tables separated, which is good model, so how big deal would this to be to implement something like this? If this already exists and i'm blind, lemme know and i'll buy you beer I hope i'm not the only one feeling like this, cheers for listening
  14. Hi guys, I have literally just installed a new site with processwire. On creating a repeater field I am getting the error: Invalid value sent to Page::setTemplate and as a result can't add any fields to the repeater. I have installed it as normal through modules and have never faced this issue before. Can anyone help please? Thank you, Mel
  15. Hello again. I have a silly problem. I feel a bit ashamed, really, but I have been searching for some time now, and I can't seem to find the issue. I have a simple site (first one I made with PW, actually), with a "file" field on a "news" template/page. So the webmaster can add a downloadable file to his news. It works fine, actually, but the field description, which should appear on the page, doesnt show up for guests. It does, as long as I am connected as an admin. But guest users (visitors) can't see it. No text is rendered. (the link itself is working.) I get the same result on local and distant site. I dont get it. Have I missed a permission setting or something ? The code for rendering the link is as follow : When connected as an admin, this outputs, for example, the following code : However, for a guest, the result is : Whatever I do. In the DB, the description is stored as : I have probably missed a simple setting somewhere about permissions. But I can't seem to find it. Maybe I'm just slow-brained today... Help ? Please ?
  16. Hello everyone, I'm looking for a way to add a submit button ('Generate PDF') for a set of templates, which generates a PDF when clicked. So, a submit-button field to which I can attach attach a piece of code. I don't want to run it every time I save, because that will be too much time-consuming. I found https://processwire.com/talk/topic/8457-add-a-new-action-button-to-page-edit-screen/?hl=%2Badmin+%2Bbutton , but I can't seem to get it working. It should be placed inside the admin.php file right? Or is making a module the best way to do this... Best, Charlie *** EDIT *** I'm currently in the middle of making the [GENERATE PDF] button module. I found the Page::editable hook which works great. Somehow it also parses immediately the parent, and because I only want to parse the current page, I remove the parent like this: $page = $event->object; $page->parent = ""; // remove parent! Is this good/okay/bad practice? Then I'm trying to add a button to the template like the following: $field = $this->modules->get('InputfieldButton'); $field->attr('name', 'generate_pdf'); $field->attr('class', $field->class); $field->attr('value', '[GENERATE PDF]'); return $event->return->append($field); But this throws me an error on the appending (Error: Call to a member function append() on boolean (line 60)... The follow up question would be: how can I add an event to when this button has been clicked, and use the current available information of that page
  17. Hi, I'm trying to setup a page field with a custom selector. Intention is to show only pages of the currently logged in user in the select drop down. Here's what I tried in the field setup: I also tried But I guess this doesn't make a lot of sense because when the page is created and has not been saved yet, the $page->createdUser isn't there yet. I always get an empty select It seems like the page field is not aware of the $user object. Is there any way how I could filter the pages by created_users_id, maybe through a hook on that field?
  18. Hello, I've a requirement where I need to have a list of pages using same template available on a page (site settings page) through page field. Basically what I need is, whenever a new page of specified template has been created, it should be automatically added to that pages list, just like home page has children. For example, I've a template called article. Articles are posted under /blog/ page. I've a site settings page which has a page field called articles_list which I use to manage articles list on some other page. This way I can manually chose what articles I want to show and in which sorting order. There's no specific sorting logic to this. So what I need is, whenever a new article is posted, it should automatically be appended on that articles_list page field so the site moderator can manually change the sorting without having to add page himself and then select the sorting. I've this weird requirement cause the site moderator can't see which new article has been added to the blog, he's just allowed to set the sorting. I hope I've clarified the requirement. I think I can use admin custom pages but it for some reason never worked for me. Thank. P.S. Forgot to mention that to add post or any other related task, I'm not using front-end, it's all through PW's admin panel.
  19. Hi, I'm just trying to delete file field via API. I want to delete it completely without concerning which pages is using it. I found this code: $fields = wire('fields'); foreach ($fields->find('name=field_name') as $field) { foreach ($field->getFieldgroups() as $fieldgroup) { $fieldgroup->remove($field); $fieldgroup->save(); } $fields->delete($field); } This removes the field from database it is OK. But it doesn't remove the files (from filesystem) that ware added to pages. As I was going through PW source code I've found that I have to save the page also, but it really complicates the thing. The problem starts in FieldtypeFile::___deletePageField method where the $pagefile is handled differently according to field output formatting. If the $pagefile is PageFile, the unlink is called which also deletes the file from filesystem. If the $pagefile is PageFiles the deleteAll is called which only adds hooks on page save. Why is it done this way? This makes inconsistency when deleting the field. Is there some better way to delete the field without caring about pages?
  20. Hello all, First time poster here. I've been playing around with ProcessWire for some time and am currently in the middle of my first project based entirely on PW. I have a problem with the field type drop-down list in the "Add new field" tab. All of the sudden it's blank. Am I missing something, or is this an error? It looks like this, no field types, nothing. I didn't even modify any particular settings in the meantime. Half an hour ago it was working just fine. Thanks in advance for any help.
  21. Hi all, I am trying to create a page field type that let the user choose a field among the list of the all the fields (to clarify: the list of fields under Setup > Fields), but I cannot make it work. I tried this: I created the field, I set the type to "Page", I went to Input tab and changed the attribute "Parent of selectable page (s)" : here I select "Home > Admin > Setup > Fields". The problem is if I go to the page the new field is there but the dropdown is empty, there are not values in it. Why? Is it because core pages like templates or fields are hidden by default? Any help is appreciated. Thank you!
  22. Hi, Is there a way we can make the Selectorfield to choose system templates ? Currently I have created a Selectorfield and added to a template. Now when I create the page, the selector only shows the templates that are not system templates. I would like to show the system templates also in the list if possible.
  23. I am looking to create a multiselect field that allows a user to select some PicasaWebAlbums on the admin side of PW. I know how to get the PicasaWebAlbums list and all, but it requires PHP. I also know how to make a multiselect field the Page input type and defining which parent holds the select options, etc. What I do not know is how I can create a custom multiselect field that is generated via PHP. For example: I have a list of albums from PHP (these are not actually what I have but you get the point): - id: 1000, title: Album 1000 - id: 1004, title: Album 1004 - id: 1008, title: Album 1008 - id: 1005, title: Album 1005 - id: 1003, title: Album 1003 How do I make a multiselect field where the options are: <option value="1000">Album 1000</option> ... etc ... Is this possible? Do I have to make a module? Point me in the right direction
  24. Not sure if this is a bug or a feature. PW 2.5 Stable When i clone a field in advanced tab of field settings i got instantly moved to fieldlist after saving, which is kind of annoying as i wanted to clone the field several times Even when i use "Admin Save Actions" Module i still get moved to fieldlist. Have a nice day Norbert
  25. Hi there! After a friend showed me the awesomeness of processwire, I'm trying to attempt my own templates now and look how I'll do. When doing that, I missed a very important feature that I couldn't really find, but I have seen it in so many pages that were made with processwire. A for or while field which can have multiple repeatable sub-fields. Pretty like FieldTabOpen, just that I can add dupilcates of the fields within that field. Example: http://depts.washington.edu/hub141/#other A more simple example that SHOULD be possible to be done via fields/templates alone without extra modules. It is possible to do that without modules, right? Please let me know.. It would be really awesome to finally have a CMS that will solve this flexibility problems. Cheers, Martin
  • Create New...