Jump to content

Search the Community

Showing results for tags 'input'.

  • 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

Found 21 results

  1. Hi, I want to redirect users that hit 1) pages using a specified template 2) when the url is using a specific syntax. Url syntax is: /PRODUCT/redir/PAGEID Example: /foo/redir/1234 My intention is to redirect the user to the specified PAGEID - but I don't know how to user $input in a hook. How might that be done with hooks in ready.php? $this->addHookBefore('Session::redirect', function(HookEvent $event) { $session = $event->object; // (Product template always lives a root level) if( TEMPLATE == 'product' && INPUT->urlSegment1()=='r' ) { $dest = $pages->get(PAGEID); $session->redirect( $dest->url ); } });
  2. With JS fetch() it is a bit tricky to get for example $_POST populated (params need to be FormData / forms), but would it possible to get PW $input (get, post, urlSegments, queryString) working for fetch requests? Is there a fix / hook / workaround to solve it PW side?
  3. Hello, I have a search page loosely based on Skyscrapers where I'm parsing a selector with options 'beds', 'bathrooms', 'size' fields. It is working well until I select 'Any' after I've run a search. This is where no results are returned (/?beds=&bathrooms=&size=&submit=). I want it to reset and show all results. I hope this isn't too vague.
  4. I'm doing an artist site and they want to be able to upload a large .tiff to their portfolio. I need to keep to a copy of the original file in the server for the art distributers, and of course serve jpg in the web front end. I had the idea of extending the file or image upload input so that if the image is tiff, keep it, and also convert it to jpg, so I could access through something like $image->originalUrl or $image->size(100, 100)->url I was wondering if you thought this a good idea, or if i'm over-engineering something that could be done simply. Also, I've never extended an input, so any examples are welcome. Thanks!
  5. Hi All, I am wondering if you could provide input on the best way an item as a user favorite. I am setting up a price comaprison website, and have most of the logic done for the site. Search results, listing page, login/logout, search, etc. It's all looking pretty good. However someone has suggested to me that users might like to save an item as a favorite. So my idea behind that was to have a button on each of the grid items in the search results page. This is my search results page code with the button within the item. <form id="add_fav" name="add_fav" autocomplete="off" accept-charset="utf-8" action="./" method="post"> <button class="wish_btn" name="add_fav">Add Fav</button> </form> Where the business logic is on the page, this is what I have so far - I just don't know how to align an item to a user. $log->save ('pageview', 'testing'); function clense_input($data){ $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } $sort = "title"; // Logic for favorites if ($_SERVER["REQUEST_METHOD"] == "POST") { if (isset($_POST['add_fav'])) { $favs = $sanitizer->text($_POST['add_fav']); if(!empty($favs)){ $ticket = $pages->get($favs); // Set page name if($favs != null){ $favs->of(false); $favs->fav_title = $page->user->name; // Save username $favs->fav_title = $page->title->id; // Save page id to favs list $favs->save(); echo "Fav saved."; } } } }
  6. Edit: The title of this post has been renamed to use the word "processor" instead of "builder" - this is not a form-building module. I'm currently putting together a simple developer-centric form processor for one of my projects, and have decided that I'd like to release it as a module as soon as it's stable enough. The idea is to separate it from the backend, and use per-form configuration files and templates instead. I could well implement a backend solution for this, but my preference is for it to be developer-centric. For me, this makes it easier to use and, of course, develop. Here's how it currently works: developer specifies forms and their particulars in a JSON file stored in the module's directory. The file includes dictations such as the name of the form, the fields it uses (along with their sanitization/validation rules), template information, and a set of emails to send when the form is being processed. An example of such configuration is: { "contact": { "name": "Contact Form", "fields": { "name": { "sanitize": "text", "rules": { "required": "Please enter your name." } }, "email": { "sanitize": "email", "rules": { "required": "We need to know your email address so we can get back to you.", "email": "That doesn't look like a valid email address." } }, "company": { "sanitize": "text", "rules": { "min(4)": "That's a tad short for a company name." } }, "contact": { "sanitize": "text", "rules": { "int": "Please enter only the digits of your phone number (no spaces or other punctuation)." } }, "message": { "sanitize": "entities1|textarea", "textField": true, "rules": { "required": "Please enter your enquiry/message.", "min(250)": "Please enter at least {$0} (but no more than 2000) characters.", "max(2000)": "You have reached the {$0} character limit. Please shorten your message." } } }, "info": { "fromName": "The ABC Accounting Team", "tel": "(011) 100 1234", "altTel": "(011) 100 5678" }, "emails": { "autoReply": { "template": "auto-reply", "to": "{input.name} <{input.email}>", "from": "ABC Accounting <noreply@abc.accounting>", "subject": "Enquiry/Message Submitted - Thanks!" } } } } As seen in the 'emails' key, templates can be defined for each email. These templates can be plain/HTML/both, and accept information regarding form input, the 'info' key, and a custom stylesheet, which is created as a file, but imported directly into the HTML version of the template. The module will also come with a jQuery module to assist in processing the form. Frontend is up to the developer/designer. Currently, the directory structure of the module is: root - forms.config.json / templates / form-name - template-name.html - template-name.css - template-name.txt I'm now thinking that it would be better to change the structure to this: root / form-name / templates - template-name.html - template-name.css - template-name.txt - config.json That is: each form will have its own folder containing configuration and templates. So I'm starting this thread to ask the following: Firstly, what do you think of this idea, and do you think you would make use of this module? Of the two structures above, which one would you prefer? Would you want the ability to make use of attachments in your emails (such as a logo)? (If I'm not mistaken, we'd then need to require WireMailSmtp or WireMailSwiftMailer...) As a side note, it's worth mentioning that this module is really intended to be used on small- to medium-sized sites that require multiple forms where developers are not in a position to obtain Ryan's excellent FormBuilder. Any input here is most welcome. (And yes, as gathered by my signature, the module is called SimpleForms. If you have a name suggestion, please feel free...)
  7. I'm trying to call an ajax function for an inputfield using Soma's method below by intercepting the call in the module init function but for some reason $this->input is always NULL. public function init() { parent::init(); $dir = dirname(__FILE__); require_once("$dir/Location.php"); require_once("$dir/LocationArray.php"); $this->wire('config')->js('InputfieldLocations', array( 'url' => "/admin/locationmodule/ajax" )); if ($this->config->ajax && $this->input->ajaxfunction == 'getcities') { header('Content-Type: application/json'); echo $this->get_cities(); exit; } }
  8. 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; } } } ?>
  9. I am trying to apply onkeyup or jquery keyup to a PW form - to autogenerate a username from a real name. This javascript/jquery works fine on test html input fields: But I can't get it to work on the fields generated by the PW forms API, even though the input id names are exactly the same. What am I missing?
  10. Am I right in understanding that there's no way to escape or encode a dash ("-") for use within a selector value (that has to be sanitized)? Looking at the code for $sanitizer it looks like it's just converted to a space. That seemingly makes it impossible to search for terms like "x-ray." Any workarounds for this?
  11. Hi guys, I would like to allow any file extension to be uploaded on a certain field, I'm aware of the security implications but this field would only be used by myself, I've tried "*" wildcard but that does not seem to work
  12. This is probably really simple but can't figure it out. note_page_id is a hidden field with the page id as it's value. $note_page_id = wire('sanitizer')->text($input->post->note_page_id); $note_page_id is an [object HTMLInputElement] rather than the value. Why is it not returning the value like it normally would? How can I get the value?
  13. Is there any way to return <?php $sectors = $input->get->project_sectors; ?> as the titles, and not the names? So instead of, for example, it returning landscape-design (the name) it would return Landscape Design (the title). Thanks, R
  14. Hello. I´d like to have an input field where the user can select one of a few choices of currencies. I there any module that can do this? thanks
  15. Hi, I'm probably missing something trivial, but for some reason I can't retrieve GET input values. Consider the following simple piece of code, named whatever.php : <?php echo $input->get->id; echo " -- "; echo $_GET['id']; ?> I make it a template, then a visible page, then I try to access http://example.com/whatever/?id=foobar but it only prints " -- " (i.e. the second echo line). I tried to make "id" a field of the template but it didn't help. What am I doing wrong ? Is it related to rewrite rules ?
  16. I'm use inputfieldForm module for custom form at front-end on my project and except CFRS there is necessary an input Captcha, it would be healthy if it is available in modules by default!
  17. output page filter by roles, output in admin and other areas, all good! on Change select page "Page 1022 is not valid for manager" Custom selector to find selectable pages > roles=manager
  18. level1=1 print_r($input->post->level1) return [level1] = 1 level1[level2] = 1 print_r($input->post->level1) return [level1][level2] =1 level1[level2][level3] = 1 print_r($input->post->level1) return null how to fix it!? processWire 2.4
  19. I think that is very useful to set mandatory fields depending on the selected template. Now, the same field can be used in different templates, ask them different postural signature, and in fact it would be nice and labeled in different templates which of these fields are required!
  20. Am trying to get my own simple contact form up and running and I would prefer to have a very simple one but understand the code that makes it work before trying to do anything complicated. I've created a contact form with contact template and have made action="form.php" method="POST" I've tried setting up a template for form but I keep getting the error that the template does not exist when I submit. On my form.php I want to start really simply just to test that the $input method is working so I just have: <?php $name = $input->post->name; echo $name; ?> Would appreciate any guidance just to get me on my way.
  21. Hi all! First of all, it's now been two weeks since i discovered ProcessWire by searching for "content management framework" and finding a Wikipedia article. The article mentioned both Joomla and Drupal - and other CMS/CMF-systems I have worked with before. I had never heard of ProcessWire, and gave it a try. Wow! It's really amazing! I saw the video on the front page, and I decided that ProcessWire just had to be the system I needed for this new page I'm working on. So, why am I posting? I've been working for the last two weeks (part time), and I've all the requirements for the page - except one. It's an internal website for our company (or, to be precise; it's for one of the regional offices for a global company), and we want our employees to be able to register how far they walk/bicycle/run to work. I'm really unsure how to set this up in ProcessWire, and I'm pretty sure I have to do this with some manual PHP/SQL code instead. So, the users on this system needs to: Register a date when they have been working, and how far they have travelled to and from work Preferably also register multiple dates, or a range of dates, when they have been travelling to and from work - together with the distance travelled Admins may select a date range and view sorted tables of travelled distance per employee Users may check their own records, and maybe compare themselves to others Users may check their total distance travelled Users may check their latest registered date Gurus, what do you recommend? What is the best way to do this in ProcessWire? Should I just set this up with separate scripts and not use fields in ProcessWire for this at all? (I know PHP and SQL, so it's not a problem - I just want to do it with the help of the framework if possible.) Thanks a lot in advance!
×
×
  • Create New...