Jump to content

Search the Community

Showing results for tags 'fields'.

  • 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. I have a module that creates a bunch of fields and none of the Options type are saving their values. The options I have set appear in the page editor, however when I go to edit any of these fields the textarea where the options are supposed to be specified is blank. $f = new Field(); $f->set("name", "iu_do")->set("label","Action(s)"); $f->type = wire('modules')->get('FieldtypeOptions'); $f->set('inputfieldClass', 'InputfieldCheckboxes')->save(); $f->options = [0 => "Import", 1 => "Update"]; $f->set("required",1)->set("optionColumns",1); $f->set("tags","-impupd")->set("columnWidth",50)->save(); How do I do this right? Thank you.
  2. This is in my module's install() function: $f = new Field(); $f->type = wire('modules')->get('FieldtypeSelectExtOption'); $f->set("name", "iu_template")->set("label", "Template"); $f->option_table = "templates"; $f->option_value = "id"; $f->option_label = "name"; //$f->filter('id not in (2,3,4,5)'); $f->set("required",1); $f->set("tags", "-impupd")->set("columnWidth",50)->save(); $f = new Field(); // set to select from template's allowed parents $f->type = wire('modules')->get('FieldtypePage'); $f->set("name", "iu_parent")->set("label", "Parent"); $f->set("derefAsPage",1)->set("required",1); $f->set("findPagesSelector","template!=admin,hasParent!=2"); $f->set("tags", "-impupd")->set("columnWidth",50)->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeOptions'); $f->inputfieldClass = 'InputfieldCheckboxes'; $f->set("name", "iu_actions")->set("label", "Action(s)"); $f->options = ["import" => "Import", "update" => "Update"]; $f->set("tags", "-impupd")->set("columnWidth",50)->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeOptions'); $f->set("name", "iu_uid")->set("label", "Match Field"); $f->description = "Values must be unique."; $options = array(); foreach(wire('fields') as $opt) { $options["{$opt->name}"] = "{$opt->title}"; } $f->options = $options; $f->set("required",1); $f->set("tags", "-impupd")->set("columnWidth",50)->save(); Oddly every time I install the module the second field `iu_parent` says it still needs configuring, without fail; I have to go to the field editor and just save it as it is one time. Anyway the real field in question here is the last, i.e., `iu_uid`. That method of adding options is entirely ineffective, sadly; it adds none at all. What I need is for it to dynamically populate with the fields in the previously selected template's fieldgroup on saveReady. This is possible with page fields, to dynamically populate options based on another field's value. Alternatively I can set up `iu_uid` like so: $f = new Field(); $f->type = wire('modules')->get('FieldtypeSelectExtOption'); $f->set("name", "iu_uid")->set("label", "Match Field"); $f->description = "Values must be unique."; $f->option_table = "fields"; $f->option_value = "id"; $f->option_label = "name"; $f->set("required",1); $f->set("tags", "-impupd")->set("columnWidth",50)->save(); Then I would just need for a hook to filter the options to correspond with the `iu_template` value. Any pro tips/guidance to spare on this subject?
  3. I need this field in a template, and then another select field which is dynamically populated with field names/references to those present in the previously chosen template for options. Any tips?
  4. Hey, I was wondering if there's a way to add more fields to specify when creating a new page. At the moment, the only two fields are required for creating a new page. Title Name (Automated) I've configured processwire so that the chosen page to create is limited to one template. Guess this would make the process to achieve the above a bit easier. Regards,
  5. Finding it quite fustrating work with fields from a module, I cant seem to find any good docs or forum threads. For example I'm making a new field on install of my module, but ideally I would like to know how to set flags, default value, max- min etc for that field but it's not obvious to me. All I can mange so far. $f = new Field(); // get a field type $f->type = $this->modules->get("FieldtypeInteger"); $f->name = $this->fieldName; $f->label = 'Publish Page later'; $f->save(); // save the field I'm finding this elsewhere with integrating with the admin, but not at all with the API itself which has great documentation. Any advice, guidance would be great!
  6. Hi, i just discovered that i can't change the field type after making a field. I made a field "checkbox" and later i decided to want that field as a radio button (Select Options Fieldtype) with two options. But i can't change it under "Basics" -> "Type". I've to delete the field and then make it new. Then i can choose the Select Options Fieldtype. I'm doing something wrong? PW 3.0.24 Mario
  7. Hi, another stupid question from a PW newbie. I'm working on a page which displays team members with some information (name, phone number, ...). For the person who edits these infos later i wanna make it as simple as possible to change the entries. I was trying to use the repeater field for some sort of grouping the infos for the several team members in the backend. This works like expected. But how to display the entries in the frontend? There i need the separate fields (name, number ...) to be able to do a formatting. Is there another way of grouping the fields in the backend, but access the individual fields for displaying in the frontend? Mario
  8. Hi everybody! I'm trying to figure out how to do what is mentioned into the title but I'm stuck into this issue and can't get a valid idea, still Let me to explain better what I'm looking for. I've seen some module (and I can't remember the name ) that asks to the user to fill a field and save the data before to come back to the module settings with other fields enabled and (maybe) pre-compiled using the previously filled field. What I'm trying to do is to make a module using the new PW 2.5.x syntax (the one which separates the module from its configuration via <module_name>Config.php file) that at installation time asks the user to select from the available templates, then submit the choice. Once submitted, the module should provide more setting fields based on the previously choosen template. It would be a great help if someone could help me to figure it out and/or point me at some module which implements this kind of logic. Thanks in advance!
  9. Hello, just another wish on my list: Multiple instances for same field. E.g. I have got a simple "text" field that's just a CKEdtior textarea. If I want to use two or more text fields, I need to dublicate the "text" field to something like "text2". I know that every field is unique because of the database structure behind. Is is still possible to make something like this for this problem? Maybe save everything to same table in database but somehow add a "instanceNumber" field that separates "text1" from "text2"? It isn't a big thing, because cloning is easy. I really like to keep redundancies low and cloning fields isn't that great, so I share this wishlist. Maybe there is some way and I don't know about it, so let me know
  10. I see it's possible to Export and Import data from the Templates and Fields panels. Awesome. Is it possible to configure these settings in a text file or files that live in the site directory? The /site/templates directory already contains PHP files for each template, but they don't cover the template and field metadata that one configures using the ProcessWire admin panels.
  11. I've got a large number of new field definitions and associated data in a development site, all of which needs to be deployed to a site that's already live in production. I know I can export/import the field data via CSV, but I'd also like to avoid the laborious process of manually recreating all of the field definitions. Looking at the database schema, it seems like I could do a structural sync (e.g., using a tool like Navicat) to add empty versions of all of the new per-field tables ("field_myfieldname"), then sync the data in the following tables: fieldgroups fieldgroups_fields fields fieldtype_options It looks like that would recreate the structure. I wouldn't sync the actual field data that way, as it looks like an easy way to get ID mismatches. I can test this on a copy of the database, but thought I'd get opinions here. Seem like a reasonable approach, or bad idea (because...)? Thanks, Jason
  12. Hello, I am building a dynamic frontend form from fields of a page, following Soma's great gist example. The form is working fine, except for multi language values. After this part of the code $form->processInput($this->input->post) when I loop over the form fields, I don't know how to access the multi language values of a field foreach($form as $field) { // how to get multi lang values here } What I tried is not working foreach($form as $field) { if($field->type instanceof FieldtypeLanguageInterface) { foreach ($languages as $lang) { $langval = $editpage->$field->getLanguageValue($lang); $editpage->$field->setLanguageValue($lang, $langval); } } else { $editpage->set($field->name, $field->value); } } Actually the $field->type returns just "text" for a PageTitleLanguage field. var_dumping the $field reveals that the language values are stored deep inside the object like 'value1023' => string 'Testworkshop2' (length=13) 'value1032' => string 'Testworkshop2 Englisch' (length=22) So how would I access those other than pulling them directly from $this->input->post?
  13. I had a sidebar template set up with a repeater (as it needed to display links offsite) and everything was going smoothly: <ul class="sideNav" data-spy="affix" data-offset-top="490" > <?php foreach($page->selectHeader->pageSidebar as $sideNav) { echo "<li><a href='{$sideNav->sidebarURL}'' >$sideNav->sidebarTitle </a></li>"; } ?> </ul> The repeater was set to include 2 fields (the link title and link URL) and output it in my template (usually constrained to 8 links). However, I now realize that I must remove the 1st and 3rd links and put them in another template as they are dependent on the page (and cant just be entered manually. My question, is it possible to inject the two links into the foreach loop so that they still appear in the 1st and 3rd spot respectfully? The two were changed to a page select, but I didnt know if that was even possible to achieve. I was hoping that I didnt have to create 8 separate fields to achieve the desired result.
  14. I am coming up close to when I need to move over my local branch to the live site and was wondering is it actually possible to move the templates (with assigned fields) over to the new site without having to reassign the fields? I know I can backup/import the fields themselves, but I have 78 fields assigned between 2 templates that would be a pain to "redo". Thanks again for all the help everyone. I am loving processwire thus far.
  15. Silly question maybe, but I'm new to PW. How can I retrieve the value of a custom field? I'm trying for the label: <?php echo $fields->get("caracteristicas_superficie")->label; ?> And it's working just fine, but: <?php echo $fields->get("caracteristicas_superficie")->value; ?> doesn't work Thanks very much.
  16. Hello guys. I am new to ProcessWire and I'm dealing now with the next: I need an image array with three properties: the image itself description and the image title ProcessWire by deafult provides me everything but the title. So I'm wondering what would be the right way to add the title property?
  17. Hello, I would like to find all fields that are multi-language. My code $langFields = new FieldsArray; foreach ($fields as $f) { if($f->type instanceof FieldtypePageTitleLanguage || $f->type instanceof FieldtypeTextareaLanguage || $f->type instanceof FieldtypeTextLanguage) { $langFields->add($f); } } Is there a more generic way of how I can determine whether a field is multi language, other than checking "$f->type instanceof" for all three fieldtypes?
  18. Hey guys, I'm trying to build a submit form with the ProcessWire API. After the form is submitted its data should be saved into different pages. I've followed Soma's great tutorial and wanted to improve it for my use case: Instead of adding every field manually to the form I already managed to automatically read out the fields that belong to a specific template like this: // Build form $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name",'$page->name'); // Build fieldset $fieldset = $modules->get('InputfieldFieldset'); $fieldset->label = 'Personal Data'; // Read out template fields and append them to the fieldset $registration = $templates->get("registration"); foreach ( $registration->fields as $field ) { $field = $field->getInputfield($page); $fieldset->append($field); } $form->append($fieldset); // more fieldsets... // Submit $submit = $modules->get("InputfieldSubmit"); $submit->attr("value","Anmelden"); $submit->attr("id+name","submit"); $form->append($submit); This seems to work great – with just one little restriction: Instead of the global field labels I would love to get the template specific settings for each field (defined within the template). E.g. in this template I'm using a body-Field not labeled as "Body" but as "Description". Same would be great for things like field's columnWidth, required properties and Co. Is this possible? Thanks a lot for your help! Nik
  19. Hi, Having ploblems with this search page code. I'm trying to get all images with tagged with the search query, which works currently. Then get a url and add <a> wrapping the image to a page that references that image in its image_select field - doesnt work. if($input->get->q) { $q = $sanitizer->selectorValue($input->get->q); $input->whitelist('q', $q); } $matches = $pages->find("imageTags.title%=$q, limit=20"); if(count($matches)) { $out .= "<ul class='grid-list'>"; foreach($matches as $m){ // $name = $m->image->name; // $out = $name; // $mWork = $pages->find("image_select=$name, limit=1"); // var_dump($mWork); $out .= "<li>"; // $out .= "<a class='' href='{$mWork->url}'>"; $image = $m->image; $image = $image->width(450); if($image) $out .= "<img src='$image->url'>"; // echo "</a>"; echo "</li>"; } $out .= "</ul>"; }
  20. I have some functionality on an intranet site that uses Lazy Cron to query an external API and then update a bunch of pages based on the API response. A problem I've noticed is that this breaks our author / editor tracking – whenever a user triggers the Lazy Cron job, the page metadata for `$page->modified` and `$page->modifiedUser` is (naturally) updated, so it now looks like that user edited the page at that moment in time, even if the content of the page was edited months ago by someone else. It seems like the ideal solution here would be to somehow exempt certain fields (the ones that get updated by this external API) from triggering a timestamp update... Any ideas on how I'd go about hooking into that?
  21. Why is field greyed out in add field?
  22. Hello everyone i gotta simple problem everytime after refreshing my backend, the fields that i have closed before are still opened (For example the repeater). is there a (maybe localstorage) functionality which remembers the action in relation to the open/close activity?
  23. I have a contact form that feeds to a engine.php. However when I go to fill it out, I get a 403 error )permission denied. I am using mamp, so maybe it is an issue with this. However, I was wondering if anyone else had run into this problem before. I have the url to the .php file using " <?php echo $config->urls->templates?>form/
  24. I'd like to use the API to get all fields that are tagged with XXX. I can't find anywhere that tells me what selectors can be can used with $fields. I suspect this isn't possible? I've realised a way to work around this - just get all the fields, and then filter them by prefix of name. But it wouldn't be quite as neat.
×
×
  • Create New...