Jump to content

Search the Community

Showing results for tags 'field'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. Hi there! And thanks for Processwire which i really like! Got a specific repeater-related question which i couldn't resolve. Will appreciate any help. Let's imagine we have Places (pages), Offers (pages) and Partners (PW users). Any Place can have many Offers attached to it via a repeater field. Any Partner can have many Places (repeater or a multiple-value field). He can offer some Offers at each Place he is attached to. His Offers for any Place should be selectable only from Offers already attached to this Place. Partner-Places-Offers management should be performed in admin interface via PW input fields. The ideal solution which i imagined could be a "dynamic" partner_place_offers repeater where multiple Offers for a single Place could be selected from dynamically built list dependent on selected Place. But it appears that PW doesn't have such functionality yet. Thanks in advance for giving some idea on the subject!
  2. Say I have a field for an unordered list. I need to have such a list twice on the page with different list items. Ideally I would create one field that can take html and only allows for <ul> and <li>. I can add the field to another template. But it seems I can't add that field twice to a template or am I missing something?
  3. Hello processwire community, this is my very first post, I am newbie in php - trying to test a simple search form which allow frontend user to search and filter data. Macro steps are as follow: 1) Create the form with options as checkboxes, allowing the user to choose multiple values selection within multiple checkbox groups; 2) Create the pw process code in order to revert back the selected items (as a result of multiple checkbox filter combination), allowing pagination as some results may be more than 50 items; --- Here some of the most related topics I've found over PW forum: https://processwire.com/talk/topic/7282-paging-issue-with-html-form-check-boxes/ https://processwire.com/talk/topic/3472-enable-pagination-for-search-results/#comment-38214 https://processwire.com/talk/topic/1883-how-to-use-input-whitelist-with-checkboxes-or-any-array/ https://processwire.com/talk/topic/1547-getting-multiple-checkbox-values-within-processwire/ https://processwire.com/talk/topic/1034-search-form-with-multiple-fields/ https://processwire.com/talk/topic/10193-multiselect-search/ --- Now, the html form works just fine (code below), it brings all checked values to the url string. Essentially I have four different groups of checkboxes: cb_sectors[] (multiple pages as categories); cb_expertise[] (multiple pages as categories); cb_status[] (multiple pages as categories); cb_year[] (integer). The user may select multiple values within the above four checkbox groups, thus creating even quite complex combination. <form name='search' id='search-works' method='get' role='form' action='<?php echo $pages->get('/search/')->url; ?>'> <div class="collapsible-header">Sector</div> <?php foreach($pages->get("/sectors")->children as $sec) echo " <p class='checkbox'> <input type='checkbox' name='cb_sectors[]' value='{$sec->name}' id='{$sec->name}'/> <label for='{$sec->name}'>{$sec->title}</label> </p> " ?> <div class="collapsible-header">Status</div> <?php foreach($pages->get("/taxonomy/Status")->children as $st) echo " <p class='checkbox'> <input type='checkbox' name='cb_status[]' value='{$st->name}' id='{$st->name}' /> <label for='{$st->name}'>{$st->title}</label> </p> " ?> <div class="collapsible-header no-padding">Expertise</div> <?php foreach($pages->get("/expertise")->children as $cb_expertise) $checked = $cb_expertise->name == $input->whitelist->cb_expertise ? " selected='selected' " : ''; echo " <p class='checkbox'> <input type='checkbox' name='cb_expertise[]' value='{$cb_expertise->name}' id='{$cb_expertise->name}' $checked/> <label for='{$cb_expertise->name}'>{$cb_expertise->title}</label> </p> " ?> <div class="collapsible-header no-padding">Year</div> <?php // generate a range of years from '09 to '17, or maybe better doing it via pages as years? for($year = 2009; $year <= 2017; $year += 1){ echo " <p class='checkbox'> <input type='checkbox' name='cb_year[]' value='$year' id='$year' /> <label for='$year'>{$year}</label> </p> "; } ?> <input class="no-class" type="submit" id="search-submit" name="submit" value="Search"> </form> The question is then mostly focusing on the second step, the pw process code: As some previous posts on this topic say - I should (in sequence) sanitize, whitelist and validate the results before pass them to the final output (correct me if I'm wrong). The thing is that I cannot find a way to get all values in a array and sanitize/whitelist/validate them -> some post suggest to use arraytoCSV as a way to let PW remember the filtered items while moving through pagination. Is arraytoCSV the best way to sanitize and whitelist the user input combination? The following code simply get selected values coming from the above form. As you can see, no sanitize nor whitelist nor validation is in place, as without the array the sanitizing function gives back only the last selected value (not the full combination for every group of checkboxes). Can you please help me implementing an array within the following code and the way to sanitize - whitelist - validate "get" values? I know for most of you is just as simple as drinking coffe, but would be great if you could drive me in the right direction. Thank you in advance! <?php namespace ProcessWire; if(count($input->get)) { if($input->get->cb_expertise) { foreach ($input->get->cb_expertise as $expertise) { // here we are just ensuring submitted products are in fact valid echo $expertise; } } if($input->get->cb_sectors) { foreach($input->get->cb_sectors as $sector) { // here we are just ensuring submitted products are in fact valid echo $sector; } } if($input->get->cb_status) { foreach($input->get->cb_status as $status) { // here we are just ensuring submitted products are in fact valid echo $status; } } if($input->get->cb_year) { foreach($input->get->cb_year as $year) { // here we are just ensuring submitted products are in fact valid echo $year; } } } ?>
  4. Hi all, Currently I'm developing a new feature for my module ImportPagesPrestashop. This module imports your categories, products and more from a prestashop database and implement that data in ProcessWire pages. I've made the following structure for this: Products (Parent Page which the user has to choose) Categories (implemented from the database) Products (Implemented from the database) And inside of the product pages several fields for the specifications of the products, description, images and more. So I've build a check inside of my module which doesn't allow you to first import the images and then the products or in another way, but you have to follow this route: Categories Products Specifications Images This is because the products require a category as their parent page and the specifications and images need a product page. Now I want to remove the check if you used this module before, so all pages you need are already there, you only need to update the pages. That's why I have done the following: $parent = $this->parent; if (!$parent->hasChildren()) { //if parent has no children, module isn't used before // set ranking in import // my code } if ($parent->hasChildren()){ //module is used before, so parent has children //no ranking in import, any button can be clicked. No specific path required. //my code } So far so good. It works and I was happy with it, until I tried to import the images of the products. I encountered a error which says this: Error: Call to a member function add() on a non-object (line 986 of / etc etc) So I was like huh, why doesn't this work. I will explain how I perform the import of the images. If the button is clicked, another function is called: if ($this->input->post->importimg) { return $this->processForm51($form); } so function ProcessForm 51 is called, below you can see this function: protected function processForm51(inputfieldForm $form){ ///... some code $this->ImportImages(); //Function is called which performs the import of the images return $this->processFormMarkupImg($imgImported); //return after the import } This function links to the function that performs the import: protected function importImages(){ // some code to get the images and store it in $pictures $pagesWithImages = wire("pages")->find("images_product.count>0"); //find pages with that field for the images foreach ($pagesWithImages as $product_page) { $product_page->images_product->removeAll(); // remove existing images $product_page->save(); } foreach ($pictures as $picture) { $id_product = $picture['id_product']; $product_pages = wire("pages")->get("productid=$id_product"); //get the correct page so the images are placed in the correct product page // ensure output formatting is off $product_pages->of(false); $str_prlink = $picture['product_name']; //make sure end of string ends with alphanumeric $image_name = preg_replace('/[^a-z0-9]+\Z/i', '', $str_prlink); $image_url = $picture['file_id'] . "/" . $image_name . '.jpg'; $image_path = "http://www.website/" . $image_url; try { $imgfield = $product_pages->images_product; $imgfield->add($image_path); //add the images to the field } catch (Exception $e) { } $product_pages->save(); } } This should work because when I perfom this import WITH the ranking in import (first categories, 2nd products etc) it works! I don't get it why this gives an error WITHOUT the ranking in import. So that's why I am asking it over here, hopefully anyone knows how to solve this. Thanks in advance, ~Harmen
  5. At page editor level I need to place a piece of code which is unique to that page. This is the code: <healcode-widget data-type="class_lists" data-widget-partner="mb" data-widget-id="xxxxxxxx" data-widget-version="0.1"></healcode-widget> This code pulls in data from a third-party site. The Body Field won't accept this code. I could place this in the template file but for that I'd have to crate a separate template file for each page. I'd rather use a common "basic_page" template file for most pages. Also, I would like to give the client the ability to change/edit code when necessary if it is at page editor level. Is there any way to achieve this? Thanks.
  6. Hello! We are currently using ProcessWire 2.7.2 for one of our sites and we're having a bit of a problem with an Image field. The field is configured to display images using the "Rows" view, display thumbnails in page editor and it has a maximum of 1 allowed file. However, when the field is rendered within a Repeater item, it defaults to the "Grid" view, completely ignoring that I had selected the "Rows" view while configuring the field. I feel that this is bad UX for the user, because if he/she wants to use the little trash can icon to delete the uploaded image, the user *needs* to know that he/she has to click the View Toggle icon first, in order to get to the "Rows" view. I want "Rows" view to be the default, so the user immediately sees the trash can icon once an image is uploaded. What do you think?
  7. Hello, I want to put some data in a table field, but if I put the label of the first table field, it gives an error: Item 'feature' set to TableRows is not an allowed type Here is my code: foreach ($fetchAll as $fetch => $feature) { $productid = $feature["id_product"]; $pages = wire("pages")->get("productid=$productid"); $pages->of(false); // ensure output formatting is off $pages->Specification->feature = ($feature['name']); $pages->Specification->value = ($feature['value']); $pages->save(); } I tried to give the label other names, but it still doesn't work. How can this be solved?
  8. Hi folks, I have a production site which has been fine for the first few months but the client is now experiencing an issue with uploading further images to a repeater field. I've replicated the problem myself and get the same result. They have uploaded the first 9 items but can't upload the 10th and beyond. The repeater field uses an image uploader then two text fields for each item to form an image gallery. We have 9 items uploaded with no problem but when we try and a 10th (and 11th etc.) the image gets uploaded OK on editing but when we go to save the page (and the admin page refreshes) the the image is gone leaving just the text fields populated and the text 'No file chosen' next to the image upload button. One thing I have noticed when looking at the site/assets/files directory folder is the last image that loaded OK is at ID 1091 and there are already folders at IDs 1092, 1093 etc. I'm not sure how PW issues new IDs but I thought it might be related. I've used repeaters for these things before (up to 43 items on one site...) but I'm foxed by it here. Host: Fasthosts Ignite PW: 2.7.2 Can anyone give me guidance or has anyone seen this on their own sites? Thanks!
  9. Ill try to explain this as best I can. I am making a site map and using the following: foreach($page->sitemap as $site) { $out = "\n<url>"; $out .= "\n\t<loc>" . $site->httpUrl . "</loc>"; $out .= "\n\t<lastmod>" . date("Y-m-d", $page->modified) . "</lastmod>"; $out .= "\n</url>"; echo $out; } This works perfectly and the url displays as http://sitename.com/data/datasetone/page-one . I was wondering for the sake of this question, is there a way to only pull from /page-one in the url? I know $site->url would give me data/datasetone/page-one, but I really need just the page name
  10. I have a module that creates a repeater field on install: $f = new Field(); $f->type = wire('modules')->get('FieldtypeFieldsetTabOpen'); $f->set("name", "iu_maptab")->set("label", "Mapping"); $f->set("tags", "impupd")->save(); $r = new Field(); $rName = "iu_map"; $r->type = wire('modules')->get('FieldtypeRepeater'); $r->set("name", $rName)->set("label", "Map Fields"); $r->set("tags", "impupd")->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeSelectExtOption'); $f->set("name", "iu_field")->set("label", "Template Field"); $f->option_table = "fields"; $f->option_value = "id"; $f->option_label = "name"; $f->set("tags", "impupd")->set("columnWidth",50)->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeText'); $f->set("name", "iu_value")->set("label", "Source Value Selector"); $f->set("tags", "impupd")->set("columnWidth",50)->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeCheckbox'); $f->set("name", "iu_static")->set("label", "Use Static Value"); $f->set("tags", "impupd")->set("columnWidth",50)->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeFieldsetClose'); $f->set("name", "iu_maptab_close");//->set("label", "Mapping"); $f->set("tags", "impupd")->save(); $rfg = new Fieldgroup(); $rfg->name = "repeater_{$rName}"; $rFields = ["iu_field", "iu_value", "iu_static"]; foreach($rFields as $rf) { $rfg->append($this->fields->get($rf)); } $rfg->save(); $rt = new Template(); $rt->name = "repeater_$rName"; $rt->flags = 8; $rt->noChildren = 1; $rt->noParents = 1; $rt->noGlobal = 1; $rt->slashUrls = 1; $rt->fieldgroup = $rfg; $rt->save(); $rpg = "for-field-{$r->id}"; $r->parent_id = $this->pages->get("name=$rpg")->id; $r->template_id = $rt->id; $r->repeaterReadyItems = 3; foreach($rfields as $rf) { $r->repeaterFields = $this->fields->get($rf); } $r->save(); Now I can't uninstall it, on account of a field being used in the fieldgroup created for the repeater -- can't delete that field because it's in the fieldgroup which I am trying and failing to delete: $rf = wire('fields')->get('iu_map'); $rt = wire('templates')->get('repeater_iu_map'); $rfg = $rt->fieldgroup; if($rf) { wire('fields')->delete($rf); wire('fieldgroups')->delete($rfg); wire('templates')->delete($rt); } foreach(wire('fields')->find("tags*=impupd") as $f) { wire('fields')->delete($f); } Please help this is such a bother. The fieldgroup should be deleted before attempting to delete the field itself.
  11. Working with a multi-language site. I have a field 'province' with the list of provinces in Options in English and in French tab. The field is selectable in the 'municipality_page' template as a dropdown box. I have an Ajax call to retrieve the choice of the province to list the municipalities of that province. Everything works well in English, however, I am having an issue with the French, I don't know if it is because the French provinces uses accents and dashes in them. I was able to make it work for 9 out of 12 provinces with the following code. $province = $_GET['prov']; if(strpos($province, "-") !== false){ $choice = str_replace("-", "|", $province); } else { $choice = $province; } $entries = $wire->pages->find("template=municipality_page, province%=$choice"); Just can't figure out how to get 'Colombie-Britannique', 'Nouvelle-Écosse' and 'Territoires du Nord-Ouest' to be found. I tried manually with the code below, but it didn't even worked. It also doesn't seemed to be a typo in the field. $entries = $wire->pages->find("template=municipality_page, province%=Colombie-Britannique"); What is missing in the code to be able to find those 3 provinces?
  12. Hi Folks, I've got a site with some contact and quote forms which get sent to my client and get saved as pages so the client has a record of the submitted forms. He'd like to analyse some of the form data. So for instance, there's a field that asks 'where did you hear about us?' with select options like 'Advertisement', 'Google', 'Recommendation', 'Magazine', etc. I'd like provide a page so the client could see how many respondents chose 'Google' vs 'Advertisement', etc. A simple tally would be fine, but then I could calculate percentages, maybe chart the results, etc. My first thought was to use $pages->count('selector') to count the pages with a certain answer. I'd know what percentage that was by comparing it to the total of saved pages for that form. But would I need to do this for each question? Is there a better way to tally/count all the answers for a given field?
  13. Hi I'm now understanding the basic of PW but for this one, I have no idea where to begin. I have 2 pages : publication and member. I want to add publications (automatically as I created them) to its member. Since I have hundred of publications, I want to create them using csv import. I used a specialised software to export them in the way I want. The format would be Name LastName1, Name LastName2 (2016) Title. Journal. Vol:Number. Url. I have variable numbers of authors by publication. My member's template have the title containing "Name LastName" and have a pageField "publi". How I can achieve that? I read in the forums I could assign page to a field via hooks. But I'm not sure what I should do. Also a more design question, do I should create all authors as unique fields? How I can create the good number of those fields? Or can I just create 1 author field in publi's template and search inside this value? Also for the others fields, do I should create them individually if I want to output this specific markup (italic, bold)? Hope it is clear... Thanks Mel
  14. Should the "New page from inputfield" option work on PW v3? Cause it doesn't seem to work for me. I have this tree for adding taxonomies and terms: Taxonomies > Taxonomy > Terms (these are templates with only the title field). Then i have a field tags of type page with parent Tags (taxonomy template), template set to terms , label is title(default) and input field type asmselect. Taxonomies > Tags > tag1, tag2, tag3 The asmselect field is displayed on the page and populated with the tags but i don't have the option to create a new term. I hope you understand my jumble.
  15. Hello, I am developing an Inputfield Module for a Page Field that has the user interact with a modified InputfieldSelector. I have added buttons on InputfieldSelector to modify a hidden HTML textfield that I have appended to the module rendering. I would like to save the textfield's contents to the database. My question is, how would I do that, given that the module is of type Page? Let me know if clarification is needed. Thanks.
  16. Hi there, I noticed, that one can easily import images from other pages into a textarea field in the backend, while the images field only allows for upload from the local machine. Correct me if i am wrong. Is there a possibility to copy images from another page, e.g. a special image repository page, into an image - type field from the backend, for the average page editor? Thanks for your thoughts.
  17. How do I get the output of a field that is a FieldTypePage? I've tried echo $page->first_name . " "; but it just prints numbers instead of picking data from that page it's referencing to. Couldn't find any info on how to use this module/field either.
  18. I used a repeater field on my site to handle arrest reports. (It's much easier for the user than say adding a new entry for each person arrested as you would a new page). Basically, my client creates a new entry with the arrest report section then starts adding repeater "records" and data which include: name dob offense mugshot ... repeat the above for each offender This is a small county newspaper and we rarely have over 100 arrests listed per report. I noticed when about 60 repeaters are added after that I get a server timeout when trying to edit the page. I bumped up max_execution_time to 90 seconds and I get a 500 error. When I set max_execution_time to 60 seconds it loads -- but that is really pushing it. It was my belief that the Repeater field type could handle lots of repeaters, with the exception of getting into say a thousand or more, but 60-70? This may take care of it for this project, but, I'm thinking about future projects. I noticed that ProFields has a Table field type and watched the video, however, I didn't see any option of adding an image field in there. Is that possible? This would allow for fast entry of data with the addition of an image for each record. Any other suggestions are appreciated. thanks.
  19. 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.
  20. 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.
  21. 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!!
  22. 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!
  23. 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!
  24. 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?
  25. short story: think of a radio button mechanic in the background, but ui-wise you present images with captions as "buttons". for instance i whant to be able to let admins change some visual themes of a single page, with different background and formating for each, i could place screenshots thumbs with a short caption. so the admins are able to se a preview image and know better what this setting does. therefore it would be needed to define images for an input field, during the field creation. maybe someone likes the idea and is able to do it?
×
×
  • Create New...