Jump to content

Search the Community

Showing results for tags 'inputfield'.

  • 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. Hey, I'm new and I created a simple module for tagging pages because I didn't found a module for it (sadly this is not a core feature). This module is licensed under the GPL3 and cames with absolutly no warranty at all. You should test the module before using it in production environments. Currently it's an alpha release. if you like the module or have ideas for improvements feel free to post a comment. Currently this fieldtype is only compatible with the Inputfield I've created to because I haven't found an Inputfield yet, that returns arrays from a single html input. Greetings Sebi2020 FieldtypeTags.zip.asc InputfieldTagify.zip InputfieldTagify.zip.asc FieldtypeTags.zip
  2. Hi there! And thanks for Processwire! Maybe i'm not very attentive but couldn't find any tutorial on creating custom fieldtype with custom inputfield. Would like to make one for selecting color(s) from predefined list of colors. The closest existing match is FieldtypeSelectOptions with InputfieldSelect but i need something different. There's a very good post from @Soma which is, however, insufficient to begin building my own fieldtype or at least to attach the existing inputfield to an existing field. Will appreciate any help. Thanks in advance!
  3. I'm in need of a special inputfield with multiple input form fields. I created a little Inputfield extending InputfieldTextarea and using it for storing the values as json encoded string. Seeing an example of Ryan recently using this technique I went and tried to do a little custom Inputfield. I got it working so far with a little try and error, but wanted to have feedback, if there's anything done wrong or could be done better. I need this to store numeric values for the 12 months. These will be used to render a chart on page. So I first did a simple textarea and having each values on a new line, but wanted something more intuitive and convienient for the client to enter the values. (I know it would also be possible (and maybe better solution) to write a complete new Fieldtype/Inputfield, but I'm not really into it yet and would need some help. But this was kinda simple and does the job, only drawback is that it wouldn't work with selectors as it's stored as json in a text field in db.) Here's my code: <?php /** * ProcessWire Custom InputfieldMonths * * Inputfield that stores numeric values for the 12 months of a year. * */ class InputfieldMonths extends InputfieldTextarea { protected $months = array( "January" => "jan", "February" => "feb", "March" => "mar", "April" => "apr", "May" => "may", "June" => "jun", "July" => "jul", "August" => "aug", "September" => "sep", "October" => "oct", "November" => "nov", "December" => "dec" ); public static function getModuleInfo() { return array( 'title' => 'InputfieldMonths', 'version' => 100, 'summary' => 'Stores 12 integer values for months of a year', 'permanent' => false, ); } public function init() { parent::init(); } public function ___render() { $values = json_decode($this->value,true); $out = ''; foreach($this->months as $label => $name) { $out .= <<< _OUT <p> <label for='$name'>$label</label> <input id='$name' name='$name' value='$values[$name]'/> </p> _OUT; } return $out; } public function ___processInput(WireInputData $input) { foreach($input as $key => $val) { if(!in_array($key, $this->months) or $val === '') continue; if(!is_numeric($val)) return $this->error("Wrong format. Value '$val' is not numeric!"); } $months_values = array(); foreach($this->months as $month) { $months_values[$month] = $input[$month]; } $data = json_encode($months_values); if($this->value != $data) { parent::trackChange('value'); $this->value = $data; } return $this; } }
  4. So is there anyway to get Inputfield Dependencies to work with front-end editing? the field is there, but it isn't showing the results I need based on the field selection it's dependent on.
  5. There seems to be a problem with loading required javascript files for inputfields when a field is loaded via AJAX. For example, if I set the visibility of an Page reference field that uses asmSelect, the inputfield UI doesn't load (it's just a plain multi-select) and I'm seeing a JS error "$select.asmSelect is not a function". When ajax loads the fieldtype, it seems as though it's not loading jquery.asmselect.js Do these core inputfields need to be updated? How to write new inputfields so that the required js in included correctly when the field is loaded by AJAX? Has anyone found a solution to this? Thanks guys! -Brent edit: here's the announcement about these new AJAX options. It says that "The AJAX-driven features should now work with all core input fields (yes, even including files/images, repeaters (!), PageTable, asmSelect, and so on)." but it's not working for me in the Reno, or default theme. I'm working with the latest dev version of PW (2.6.17)
  6. Greetings from germany, i develop a shop for a customer and wanted to give them the opportunity to find products without any images so they could easily fill this empty sites. The problem is, that this images are placed inside a repeater. So the structure for the repeater field is: title bild (where 1 image can be placed) bildrecht (another repeater for placing the copyright text) But here comes my problem. I designed a selector that should show me all sites where the repeater count is 0. Like : template=sorte|artikel,bilderrepeater.count=0 But it also shows me results, where the repeater count is still 1 or even greater. If i save one of these bad results, the selector works fine. Is there a way around it ? I use pw 3.0.76.
  7. Hey Everyone, I'm running into an issue when creating a new PageReference field type. Just creating the field and saving causes an exception to be thrown. Right before saving: https://www.dropbox.com/s/y4k7uw6dg5x1pmu/Screenshot 2017-11-25 09.27.13.png?dl=0 Right after saving: https://www.dropbox.com/s/gi9mbthg16fewc8/Screenshot 2017-11-25 09.27.28.png?dl=0 Running PW 3.0.83 Any ideas what might be going on?
  8. I'm trying to add a new option to InputfieldTextarea. Depending on that option, I want to change how the input is rendered. I also want to change this option depending on different templates and repeaters, meaning it can have different values for different fieldgroups. I hooked into three methods: $this->addHookBefore('InputfieldTextarea::render', $this, 'hookInputRender'); $this->addHookAfter('InputfieldTextarea::getConfigInputfields', $this, 'hookInputSettings'); $this->addHookAfter('InputfieldTextarea::getConfigAllowContext', $this, 'hookInputContext'); In hookInputSettings, I build the additional option protected function hookInputSettings(HookEvent $e) { /** @var InputfieldTextarea $field */ $wrapper = $e->return; $field = $e->object; /** @var InputfieldSelect $font */ $font = $this->modules->get('InputfieldSelect'); $font->label = $this->_('Font'); $font->name = 'fontFamily'; $font->addOptions(self::fontOptions); $font->attr('value', $field->fontFamily); $wrapper->add($font); $e->return = $wrapper; } It shows up in field settings with no problem When I pick an option and save, it even shows up in the database. However, I cannot get the properties of that field in that fieldgroup context. Most other inputfields can get their inputfield settings because are inside a class that extends Inputfield, so $this->myOption works. If I hook into FieldtypeTextarea::getConfigInputfields, it works too, because getConfigInputfields method is called with $this as its argument, inside hooks it's possible to access fieldgroup specific settings. But for Inputfield, it's not given any arguments, so hooking Inputfield::getConfigInputfields, you won't be able to get any information about the context. // /wire/core/Field.php public function ___getConfigInputfields() { // ... if(!$fieldgroupContext || count($allowContext)) { // ... try { $fieldtypeInputfields = $this->type->getConfigInputfields($this); // ... } // ... } $inputfields = $this->wire(new InputfieldWrapper()); // ... if($inputfield) { if($fieldgroupContext) { $allowContext = array('visibility', 'collapsed', 'columnWidth', 'required', 'requiredIf', 'showIf'); $allowContext = array_merge($allowContext, $inputfield->getConfigAllowContext($this)); } // ... $inputfieldInputfields = $inputfield->getConfigInputfields(); // ... } // ... } So, as a solution I gave it $this as a parameter // $inputfieldInputfields = $inputfield->getConfigInputfields(); $inputfieldInputfields = $inputfield->getConfigInputfields($this); Now everything works without any hacks. It works in field settings, templates, repeaters just fine. protected function hookInputSettings(HookEvent $e) { // ... $field = $e->arguments(0); // ... $font->attr('value', $field->fontFamily); // WORKS! // ... } I wanted to write this post because it drove me mad last night. I guess the next step is to make a pull request.
  9. Hey guys... Ok so I have a problem with a registration form password inputfield... The problem is that InputfieldPassword.js and InputfieldPassword.css are not loaded/fired. Or I dont even know exactly what is happening... Im pretty new to processwire and the website was not created by me so Im trying to figure out what has been done and how processwire works. Anyway this is how the form looks right now: ...and as you can see the styling is off (password validation check in particular)... this is what I see when page is loaded (without adding any input)... it looks like js and css files from wire/modules/Inputfield/InputfieldPassword are not firing... I dont know how it is supposed to work exactly so I dont even know where to start. Maybe someone has had similar problem and know an easy fix or can navigate me to what could cause this situation in PW. Oh by the way this problem occured when upgrading the PW version (current version 3.0.65)... everything else is ok... this is the only problem that has been found after upgrade... Appreciate all the help! Cheers!
  10. Hello, I try to realize some booking form via jQuery.post method. It works to send the data to the book.php file. Whats next ? How to handle the data right. this is the JS code jQuery.post("./book.php",{ xx_name: name, xx_email: email, xx_date: date, xx_time: time, xx_message:message, xx_contact: contact}, function(data) { jQuery(".book_online_form .returnmessage").append(data);//Append returned message to message paragraph if(jQuery(".book_online_form .returnmessage span.book_error").length){ jQuery(".book_online_form .returnmessage").slideDown(500).delay(2000).slideUp(500); }else{ jQuery(".book_online_form .returnmessage").append("<span class='book_success'>"+ success +"</span>") jQuery(".book_online_form .returnmessage").slideDown(500).delay(4000).slideUp(500); setTimeout(function(){ $.magnificPopup.close() }, 5500); } if(data==""){ jQuery(".book_online_form")[0].reset();//To reset form fields on success } }); It works for me i get the data but what now ? how to handlte this right ? this is the post.php <?php include("./index.php"); // include header markup $sent = false; $error = ''; $emailTo = 'my@email.here'; // or pull from PW page field // sanitize form values or create empty $form = array( 'fullname' => $sanitizer->text($input->post->name), 'email' => $sanitizer->email($input->post->email), 'comments' => $sanitizer->textarea($input->post->message), ); print "CONTENT_TYPE: " . $_SERVER['CONTENT_TYPE'] . "<BR />"; $data = file_get_contents('php://input'); // Dont really know what happens but it works print "DATA: <pre>"; var_dump($data); var_dump($_POST); var_dump($form); print "</pre>"; if($input->post->submit) { $name = $_REQUEST['xx_name']; echo "Welcome 1". $name; // DONT WORK }else{ echo "Something is wrong on the submit "; } if( $_REQUEST["xx_name"] ) { $name = $_REQUEST['xx_name']; echo "Welcome 2". $name; // WORK } I have attached the output. how to act with the pw $input->post->submit and the form array for example ??
  11. Hi, I am trying to create a module for a webshop in which I can predefine a number of thumbnail sizes for my product images. I was thinking of storing each of these image sizes as a child page with 'width' and 'height' fields under the module page , so I can use a PageTable input field in my module to easily manage them. I know how to create a Pagetable field and add it to templates so I can use it in regular pages, but because I am planning on implementing some other functionalities that (I think) can't be achieved with a regular page, I need the PageTable field to work within a module. So far I have come up with this piece of code by trial and error: $page = $this->page; $field_sizes = $this->modules->get("InputfieldPageTable"); $field_sizes->title = "image_sizes"; $field_sizes->label = "Image sizes"; $field_sizes->set('parent_id', $page->id); $template = wire("templates")->get("image_size"); $field_sizes->set('template_id', $template->id); $field_sizes->set('columns', "title\nimage_width\nimage_height"); $wrapper->add($field_sizes); It works in that it does display an empty PageTable in my module. I can also add pages and they will be added as child pages under my module page, but when I do, the way the PageTable is displayed gets all messed up. Instead of showing the newly created page as a row in the PageTable, all the fields on the module page (including the PageTable field itself) are repeated within the PageTable field. I hope my explanation makes sense. I am fairly new to Processwire (and module development in particular) so perhaps I am just trying to use PageTable in a way it was not intended to be. Maybe you guys could give me some directions on how to achieve what I am looking for? Thanks!
  12. I'm using this piece of code to add a table layout to my module configuration: $this ->wire('modules') ->get('MarkupAdminDataTable') Then I use this to add rows to my table: $this ->wire('modules') ->get('MarkupAdminDataTable') ->row($data) But when I try to add a field to my table, It's not rendered as a field, I only see the the classname of the input field instead of the field itself. Is it possible to render a field into a table row?
  13. Hey y'all! I've been digging through the forums trying to find a workaround for the Page AutoComplete Field. So far, no luck. Here's the problem: Currently, to use the Page AutoComplete Field, you have to define a single parent for the pages you want to select from. I want to use the AutoComplete field to add multiple pages from different parents. For instance, I have a field for location, and I want to add the MET Museum and The Louvre, but the MET has parent USA, and the Louvre has parent France. Currently, it's very labor intensive to scroll through a list of 300+ locations, or use AsmSelect to drill down. AutoComplete would be a godsend. I've not been able to find any way to workaround this issue, any ideas? Thanks for any help or recommendations! — Reed
  14. Hello @ all, I have tried to combine multiple conditions with an OR statement at inputfield dependencies but it doesnt work. condition1=2 OR condition2=1 I havent found anything about this. Has anyone tried to achive the same and found the correct syntax or is this still impossible? Thanks
  15. Happy New Year to everyone! For a project that I'm working on, I needed to have dependent checkboxes on page edit forms in the admin. Just like dependent selects but for checkboxes. I couln't find anything and decided to write my first Inputfield module. I have only tried it on PW > 3.0. But it should also work on the 2.x branch. Would be great if some of you could try it out and give some feedback. You can find the module InputfieldDependentCheckboxes at github Here's some screenshots of the module in action and instructions on how to use it. ##An Inputfield for ProcessWire admin interface that handles the display of dependent checkboxes in page fields Sometimes we need checkboxes to depend on other checkboxes in our page edit forms. This module adds this functionality to standard page field checkboxes for 2 or more checkbox fields. ## Installation 1. Copy all of the files for this module into /site/modules/InputfieldDependentCheckboxes/ 2. In your admin, go to the Modules screen and click "Refresh". Under the 'Inputfield' section, install the 'InputfieldDependentCheckboxes' module. 3. Open Modules->Configure->InputfieldPage. Under 'Inputfield modules available for page selection' add 'DependentCheckboxes' from the select dropdown and submit ##Field Setup This inputfield extends the standard checkboxes for page fields. Therefore you need to have page fields configured already that you can extend with this Inputfield type. ###Prerequisites You need to have at least 2 fields of type page that have 'Checkboxes' defined as Input field type and live on the same template. A real world example: There are different types of instructors. Each instructor type can have multiple different certifications. For this to happen, we need 2 page fields (multiple): A) instructor_types: lists pages with template 'instructor_type' B) certifications: lists pages with template 'certification' The certification template needs to have the instructor_types page field to assign one or more instructor_types to a certification. ###Setup (link checkbox fields) 1. Edit your page field A and go to the 'Input' Tab. Under 'Input field type' choose 'DependentCheckboxes'. Hit save. Now under 'Choose the target checkboxes field' choose the name of your field B. Hit save again. 2. In your page field b make sure to choose a template under 'Input' Tab under 'Selectable Pages'->'Template of selectable page(s)'. Your fields should be setup. If you now edit a page that contains the 2 fields, the dependent checkboxes should be working. EDIT: And yes, this is working for multiple dependent checkboxes, too. (I have tried it with 3 so far) Some notes on how the module works behind the scenes: - parent checkboxes (actors) that have dependent checkboxes (targets) get custom data attributes applied which contain arrays of the targets' IDs - some Javascript is initiated on acxtors and targets to handle the display based on the id arrays in the data attributes. EDIT: since this module's mention in ProcessWire Weekly it might get some more attention. I just wanted to point out that it is still in alpha state. I will continue development and more thorough testing while implementing it in an ongoing project within the next 3-5 months or so. I will eventually release a stable version then. If you use the module with only 2 dependent checkbox fields, it should work smoothly. There are still some quirks when using 3 or more and I need to figure out how to best resolve them. So please be patient (or jump in with ideas ).
  16. Hello and Happy New Year to everyone, I'm trying to implement module configuration fields in an Inputfield Module following Ryan's blog post https://processwire.com/blog/posts/new-module-configuration-options/ Is this supposed to work for all modules? My module extends InputfieldCheckboxes. This is the structure of my module folder: The InputfieldCheckboxesDependenciesConfig.php is not being picked up at all. When I configure it the old way with ___getConfigInputfields(), it is working.
  17. Hello, I need to add some markup to checkbox inputs of page fields in the admin forms for which I created an autoload module with $this->addHookBefore('InputfieldCheckboxes::render', $this, 'renderCheckboxes'); The renderCheckboxes method aims to replicate, extend and then replace the original render method of InputfieldCheckboxes. I'm having trouble finding the right class context from within my renderCheckboxes method. In the original render method there is code like $this->checkDefaultValue() where $this represents the context of ProcessWire\InputfieldCheckboxes and checkDefaultValue() is a method defined in the parent class InputfieldSelect. In my renderCheckboxes method, I need to be able to access the same class context in order to replicate the original render method. public function renderCheckboxes($event) { $inputfield = $event->object; if($inputfield->name != 'certifications') return; var_dump($inputfield); $inputfield->checkDefaultValue(); } The var_dump tells me that $inputfield is an object instance of ProcessWire\InputfieldCheckboxes, just like $this in the original render method. But when I try to do $inputfield->checkDefaultValue(), I get an error: Method InputfieldCheckboxes::checkDefaultValue does not exist or is not callable in this context This tells me that the context for the $event->object is not the same as for $this in the original render method. Obviously I don't know enough about OOP and PW module development to understand what is going on. But I would like to be able to replace that render method with my own. Any pointers on how to achieve this would be very much appreciated.
  18. I have a process module like so: public function execute() { $output = 'mad music archive/bulk uploadability management'; $form = $this->makeForm(); if($this->input->post->import) $output .= $this->bulkup($form); else $output .= $form->render(); return $output; } public function ___install() { $mkr = new ImportShorthand(); $p = [[ 'template' => 'admin', 'parent_id' => 2, 'name' => self::PGNAME, 'title' => '[Blaudio] Mgmt', ],[ 'process' => $this, ]]; $mkr->newPage($p); } public function ___uninstall() { $wp = wire('pages'); $pg = $wp->get('template.id=2, parent.id=2, name='.self::PGNAME); if($pg->id) $wp->delete($pg, true); } private function bulkup($form) { if($this->input->post->import) { $form->processInput($this->input->post); return; if(!$form->getErrors()) { $files = $form->get("bla_upload")->value; if(count($files)) { return count($files);/* $bulkload = $bulk_upload->first(); //$bulkload->rename("address-import.csv"); $bulkloadname = $bulkload->filename;*/ }else{ return "No files were found"; } //$this->session->redirect("../edit/?id=$list_id"); } } } private function makeForm() { So far, returning early in the bulkup() function, submitting the form with an acceptable file results in this error message: Upon reloading the page (afresh, without the submitted data; i.e., clicking its link in the nav) this error is displayed within the upload field: I'm assuming this is due to the fact that this is a process page. How do I ensure temporary storage? My goal ultimately is to insert a new page for each valid file. Thanks much in advance.
  19. Hello, I'm trying to hide a specific field with a hook. This is what I tried so far. Changing the field label works but the hiding not. Changing addHookBefore to addHookAfter makes no difference. I searched the forum and found similar thread but could not translate the answer to this situation. Any help would be appreciated. class HideFields extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Hide Fields', 'version' => 100, 'summary' => 'Hide fields', 'singular' => true, 'autoload' => "template=admin" ); } public function init() { $this->addHookBefore('Inputfield::render', $this, 'setHide'); } public function setHide($event) { $inputfield = $event->object; if($inputfield->name != "Foo") return; $inputfield->label = "Bar"; // This works $inputfield->collapsed = Inputfield::collapsedHidden; // This doesn't work } }
  20. I'm new to processwire and i'm looking for a solution to handle post requests with inputfields. At the moment my code looks like this: class InputfieldTest extends Inputfield { ... public function init() { if($this->config->ajax && $this->input->InputfieldTest){ header('Content-Type: application/json'); echo "{'test':'test'}"; exit; } } ... } And then there is a JS file with: var testdata = { InputfieldTest: 'InputfieldTest' }; testdata[$('#testa-tokenname').text()] = $('#testa-tokenvalue').text(); $.ajax({ url: "http://bla.at/processwire/page/edit/?id=1816&InputfieldTest=1", data: testdata, type: 'POST', success: function(json) { alert(json); } }); Everything works fine with a GET request, but with the POST i just get the message {"error":false,"message":"AJAX Page not saved (no changes)"} Any ideas? Or is it all wrong and i should use a different approach?
  21. Often, the pages I find myself referencing in a page field (whether through asmSelect or otherwise) are very simple. They might be categories, tags, or something along those lines, but they only contain a single text field. In cases like these, it would be great to be able to add new ones from the page that contains the referencing field. So if, for instance, I were adding a new page to a site, and had a "topics" field that selected pages from /topics/, and I realized that topic didn't exist yet, I could add it from the page without having to go back to the page tree, navigate to /topics/, create a new topics page, publish, then return to my unpublished new content page. I suppose the most straightforward plan of attack would be to create a new inputfield module, but ideally, this could be applied to any of the existing ones, whether checkboxes, asmSelect, or auto complete. Can a module extend other modules in that way?
  22. Out of necessity (that is, my editors having created pages with hundreds of files attached...) I've whipped up a small module that adds a live search box (just plain jQuery hide/show) to file input fields (just for InputfieldFile, not images, and no searching descriptions yet). I've called it InputfieldFileFilter. If anybody wants to give it a try, it can be found at https://github.com/BitPoet/InputfieldFileFilter It's currently running on PW 2.8, though it should be compatible with other versions as well. I'd be happy to get a little feedback if this is worth rolling into a more elaborate module. The module is really only in alpha state right now, so I'd not recommend to put it onto a production system, and it does need quite a bit of testing. InputfieldFile has a lot of js magic attached after all...
  23. Hello, I want to know, is there any chance to render only visible fields based on their Dependencies? For example, I have many fields in template with conditional logic. But all their values stored in DB, and render in loop with $page->$fields. I could duplicate logic in PHP, but It's seems very inefficient. I couldn't find any API command for such task. Something like flag "isShown". More over, there isn't such flags when I printed array. I just can't find it, or this data keeps somewhere outside? Or is there some other ability to achieve this? Thanks for any advise in advance.
  24. Hi everyone, I am fairly new to ProcessWire and am trying to get the hang of creating custom InputFields. Specifically, I am trying to combine two of the core inputfield modules into one custom inputfield. Something that looks like this: The purpose of this InputField: - Used in the Admin area, in the Edit area of a particular page - In the search, I query for a particular item that exists in PW - In the results, I can press an add button besides an item that I am interested - The items that I added is put on the top (the green area), where I can delete them later if I wish - I can search for new items, get new results, but the green area with the items that I'm interested in previous searches do not go away (unless I navigate away from the page). So a couple of questions about this: - Is the top element (the green part) called InputFieldAsnSelect and the bottom part (the search AND the search results) called InputFieldSelector? - What is a good way to approach this? I'm kind of at a loss on what to do. - Do I create a module that extends both InputFieldAsnSelect and InputFieldSelector and try to get them to interact with each other? If so, how? Will this be mostly in JS or in the PHP module? If not, how should I approach this and what should I educate myself on to make this possible? - My InputField is meant to be able to search all the templates and fields. Would this be possible? If I get any of the terminology wrong or if a glaring mistake in my understanding of PW is spotted, by all means please point it out. Thank you!
×
×
  • Create New...