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 guys, I'm really really desperate for help at this stage, for my own sanity mostly. I've been trying to set up a form that requires several fields one of which is a file upload, the user can upload max 10 files with extension jpg/png/jpeg and these are sent to the admin email as attachments. Currently this i am using the InputfieldFile module, I have moved it over to /site/modules because hooking the return html wasn't enough for my needs. So basically I have this. $images = $modules->get("InputfieldFileCustom"); $images->attr('label', "Upload your images"); $images->required = 0; $images->maxFiles = 10; $images->attr('id+images','image'); $images->attr('placeholder','no file selected'); $images->attr('extensions','jpg'); $form->append($images); I expected output that would allow me to upload and delete files. Except right now my biggest issue is the fact that the remove button isn't being displayed because the ___renderItem method isn't being run and I have no idea how to make this work. I'm going to have to do a lot of fun stuff with the markup for the majority of the render methods but I can't do anything until I get the remove button to display. I also made a inputfieldfilecustom.js which is imported on the page. I've renamed all instances of InputFieldFile to InputFIeldFileCustom (in both js and module) Begging for help around now. it would be incredibly appreciated if someone can give me any direction.
  2. Hello, I would like to utilize wire/modules/Inputfield/InputfieldIcon/ in a module. I found that icons.inc there does not include all FontAwesome 4.4 icon classes. Is the selection of icon classes in icons.inc opinionated for use in PW or is it just not up to date? Anyways, I put together some code to produce a icons.inc with all available FA icon classes from master branch, sorted alphabetically: <?php $url = "https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/src/icons.yml"; $faArray = yaml_parse_url($url); // pack all icon ids (classnames) in array and sort alphabetically $iconClasses = []; foreach ($faArray['icons'] as $key => $row) { $iconClasses[$key] = $row['id']; } array_multisort($iconClasses, SORT_ASC, $faArray['icons']); // write all fa classnames to a file $file = "icons.inc"; $prefix = "fa-"; $out = fopen($file, "w+"); foreach ($iconClasses as $c) { $class = $prefix . $c . PHP_EOL; // echo $class . "<br>"; fwrite($out, $class); } fclose($out);
  3. Is there a example / howto write custom fieldtype / inputfield module? Searched the forum and asked google. If there is no howto available someone could suggest an easy module to take a look at the source code.
  4. Hi, is there actually a function in Processwire to create forms from a JSON array with corresponding attributes, so that something like { "title":"Duck Count", "type": "InputfieldInteger", "label": "How many ducks?" },{ etc ... } would become a form with all the fields? Otherwise it would be a nice-to-have I guess? I will give it a try for a module now - could be enhanced then. Or has anyone already build something like that? cheers, Steffen
  5. Hello, My Goal: To create a custom module that will take an array of images and generate a sprite sheet, as well as, the CSS to access each sprite. (This part I have completed ). To have it be a custom InputType, so that every image field does not create a sprite sheet. (Still needs to be completed). To create an admin page for the module to allow you to customize the output, size, etc. (Still needs to be completed). My Problems: Currently, it is looking at a specific folder that is hardcoded in the module, and creating a sprite sheet from those images. I suspect that creating a custom InputType would allow me to have the folder dynamically set based on the page that is using the module. I am struggling on finding the proper documentation that would allow me to do that. I also, have created a "Create Sprite Sheet" button and have it hooked after the page save button... on every page, even if there isn't an image upload on that page .I would like the create sprite sheet functionality to be hooked to the actual page save button only on the pages that have the custom InputType that needs to be created - mentioned above. I'd appreciate any help/direction provided, to help me achieve my goals. Also, if anyone has any recommended features that they think would be helpful as a part of this module, please feel free to make suggestions. Thanks in advance.
  6. I would like to provide a way to for the caller to configure an Inputfield when getting it, i.e., when either __construct or init is called, as opposed to having to set each field independently after the field has been instantiated. How would I do that? What I have now: // get a password field $field = wire('modules')->get("InputfieldPasswordGeneric"); $field->attr('id+name', 'password'); $field->attr('size', 40); $field->required = true; $field->label = 'Password:'; What I'd like to do (conceptually): $defaults = array( 'required' => true, 'label' => 'Password:', 'allow_whitespace' => false, 'numDigits' => 0, ); $field = wire('modules')->get("InputfieldPasswordGeneric", $defaults); $field->attr('id+name', 'password'); $field->attr('size', 40); I could just create a property, like defaults, and decode that. But the code won't see that until rendering time so will have to do additional processing each render. It seems like it belongs at initialization or construction time.
  7. I've created an Inputfield module but have some questions about how the initialization works. The field works, but I don't understand how the class is being initialized and default values supplied to ___render. If I don't set the value in my code that executes wire('modules')->get('InputfieldMine') then no default value is supplied to ___render even though it's clearly set in __construct. Excerpted logic for my module/class (InputfieldMine): public function __construct() { parent::__construct(); $this->set('minLength', 6); wire('log')->save('trace', "__construct $this->minLength"); } public function init() { parent::init(); // other stuff $ml = $this->minLength; wire('log')->save('trace', "init $ml"); } public function ___render() { $ml = $this->minLength; wire('log')->save('trace', "___render $ml"); } I'm writing a log in __construct, init, and ___render. Excerpted logic from where I'm using the InputfieldMine: // get a my field wire('log')->save('trace', 'B4 LOAD'); $field = wire('modules')->get("InputfieldMine"); wire('log')->save('trace', "AFTER LOAD $field->minLength"); // ellided setting of attributes and properties $field->minLength = 6; wire('log')->save('trace', "AFTER SET $field->minLength"); $form->add($field); I'm writing a log before loading the module, right after loading the module, and after setting the minLength. The log sequence I get is: B4 LOAD __construct init AFTER LOAD AFTER SET 6 ___render 6 So it's clear that the ->get method causes both the constructor and the init function to get invoked as I'd expect. What's not clear to me is why the value set in __construct isn't get-able after $this->set('minLength', 6); is executed. The 6 is present in a var_dump - it's in the data: array['minLength']. If I remove the line: $field->minLength = 6; right before the "AFTER SET" log call then the value is null when ___render is called. What is the purpose of setting minLength to 6 in the constructor? And how would I cause the Inputfield to use it?
  8. Hi folks, As the topic suggests... is there a way to add a parent_id to the dependency field? I managed to find this in the forums https://processwire.com/talk/topic/4323-field-dependencies/?p=56858 which seems to state that @ryan didn't understand why this didn't work. I need to show a field only if the parent_id=1032. Any thoughts?
  9. Hi folks, Firstly... what an incredible CMS. Just been a breath of fresh air and really finding it so powerful. So thanks! Just a quick question. I read on the Inputfield Dependencies docs that OR selectors | aren't supported here yet. This is fine... but is there an alternative or another way to do the example below? I have a Pagefield set up for a 'Members' section, to choose whether the member is a Chair or Vice Chair when adding each children page to this section. If they select 'Chair' OR 'Vice Chair' from the dropdown, I would like a specific field (email address) to be shown. I have done some input dependencies on other fields/templates (show a closing_date field if the news type is 'Job') etc. but have only ever had one dependency to declare. Now I have two, which I know you can separate with a comma, but essentially, it needs to be if either 'Chair' or 'Vice Chair' is selected from the Pagefield dropdown. chair_vice=1062|chair_vice=1063 chair_vice=1062|1063 You see what I mean? Any clues/tips? Or would I need to create two fields here? An email field for Chair and an email field for Vice? Thanks in advance, R
  10. I think it would be a nice idea to add an image/field count to these inputfields. Something like below, where it says '(12)'. For me this would be a handy little addition.
  11. Hi, all. I've read through most of soma's thread "Create simple forms using API" and think I understand the basics pretty well. I fall in love more and more with Processwire each day. First, I am wondering if it's possible to not display the error messages inline, with each form field, and instead show a list of errors at the top of the form. The typical UI I use for form error messages is "Please fix the following errors and re-submit the form" followed by an unordered list of the error messages. I see that the getErrors() method returns an array of the field names and error messages, so that is simple enough. I'm not sure how to turn off the error messages that display with each form field, though. Secondly, I am wondering if it's possible to customize the error message for each field, via the API. I understand the text can be internationalized, but I am looking for more specific messages like "Please enter your First Name" instead of "First Name: Missing required value." Thanks for any help!
  12. Hey, I've made a gallery and it all works fine, all the images are in an image inputfield and when I upload a bunch it puts the images in the order the pictures are uploaded. How can I sort the pictures on the title? The titles are like following mih_5500-1200.jpg and mig_5555-1200.jpg etc etc I display the pictures with <?php foreach($page->images as $image){ //blabla } ?>
  13. Quick question: Is there a module/inputfield type for images like the one in TinyMCE where you set pages and get the images listed? This would be very handy for avoiding that clients upload images again and again. Thx in advance!
  14. Hello everyone, I'm new to ProcessWire, and (this may sound cliché but) it's awesome... I've only used it for 3 days and already modified some of the admin UI for ease of use and configured a toolbar. Today I was creating a module but I'm not really PHP-saavy, so when I got this error, I was pretty much stuck: Fatal error: Cannot instantiate abstract class Inputfield in C:\xampp\htdocs\processwire\wire\core\Fieldtype.php on line 79 This module uses the integer inputfield and the page inputfield, I noticed that on Fieldtype.php, line 78 says: "// TODO make this abstract" so I'm wondering if that could have something to do with the fact that it's not working or if there's something wrong with my code. Thanks in advance. //Nicole
  15. Hello everyone, I'm currently working on a simple module (view this thread for more details) and ran into some problems with the validation of input data. I did some research, but I wasn't able to find answers to these questions: 1. If you develop your own Inputfield/Fieldtype module, where do you do validation? I've seen other modules do it in Fieldtype::sanitizeValue() (apigen), but this seems rather strange to me. Also, as far as I got it, they didn't throw any errors back to the user but just quietly changed everything, that doesn't make sense without the user knowing it. This leads to the next questions: 2. What is the correct way to get visual validation error reports to the user? 3. How to prevent a page from saving with validation errors? With this fairly basic stuff (where I wasn't really able to find something meaningful about) out of the way, what I really want to know is this: 4. How do you add validation with error reporting to an existing Fieldtype module? I want to add my custom validation with error reporting to the standard FieldtypeTextarea module (only when some conditions are meet in the corresponding Inputfield for sure), but I have no clue what would be the way to go there and wasn't able to find any module that does it like this. Please shed some light on these question, would be very much appreciated! Marc
  16. Well, I'm weird because I have several email addresses that have dashes in them in the local domain part (before after the @). This is perfectly legit and my email addresses certainly work. However, PW's email input field always seems to complain if I try entering one of these dashed emails into it. I haven't tried it yet with PW, but '+' can turn up occasionally in gmail addresses. Any chance that we could support weirdos like me with the email input field? Edited to correct mistake.
×
×
  • Create New...