Jump to content

Search the Community

Showing results for tags 'select'.

  • 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. Hello all- FieldtypeFormSelect does what the post title says it does. Lets you create a field to select a form created by the FormBuilder pro module. This type of field (or some variation of it) has probably been done elsewhere but I put this together with a few extra considerations for flexibility and utility. When creating a form select field you can choose what forms will be present and how their names will be shown. Let's go to the pictures: A form select field: Creating fields to choose from specific forms? You have options. You can also create a field that will only include forms that begin, include, or end with a specific string. This allows you to create a field once, then use form names to help group them together and add/remove them from form select elements without editing the field. This is also a pretty simple way to allow end users to create forms that will be selectable without having to ever edit a field configuration. For example, this field will only allow you to choose forms having names enting with "request", so "customer-support-request" and "consultation-request" will be included, but "newsletter-signup" and "call-to-action" won't. You can also choose how the form names will be presented in the select element. They can be shown as they are originally named, as spaced words, or as capitalized/spaced words. So, how does this field work? Form select fields store the ID of the form you select, but it also has a nice trick for working with forms in your markup too. FieldtypeFormSelect makes use of ProcessWire's built-in field rendering to keep things simple. Let's go to the code. <?php $page->select_a_form; // => Outputs the form ID, or null if no form has been selected // You could do this to output your form markup echo $forms->render($page->select_a_form); // Or you can do it this way. If a form has been selected the markup will be output to the page, if no form is selected, the output will be null. echo $page->render('select_a_form'); The fields you create will always be up-to-date with the forms that have been created in FormBuilder. This module also keeps things tidy- if a form is deleted that has been selected in one or more fields, on one or more pages, the values for those fields will be set to null so you won't experience any reference errors to form IDs that no longer exist. My primary use is to have a form select field available for blocks created in the RockPageBuilder module by @bernhard. I wanted each section on the page to contain an option to include a call to action button that can be a link to a page, a link to another URL, or that can open a modal with a call to action form to capture leads and visitor contact information. It's a great way to easily add flexibility and give some extra power to the end user when considering what they want visitors to do when browsing their website. RockPageBuilder is not required, but makes for a useful example! Protip for website designers- in my experience and empirical study of conversion analytics for sites that I've built, buttons located within sections of content on the page captured more leads and outperformed a call-to-action button in the page header, the call-to-action form at the bottom of the page, and forms located on a "Contact Us" page- by far. The true purpose of this field is to get the right forms in the right places quickly and easily without any need to work around markup output strategies or short codes. Contributions on Github are welcome if there's some extra functionality anyone wants to add that makes sense. Please let me know if you run into any bugs as well, when there's some extra usage and testing I'll submit it to the modules directory. Hope you find it useful! https://github.com/SkyLundy/FieldtypeFormSelect
  2. Hi, Please find the screenshots attached. We have a repeater field on the test1 page. On the test2 page, we would like to select values of titles created in the test1 page. Please suggest. Thank you.
  3. Hi, I need to populate a multi selection field with all the children of a template. How would you proceed? Thank you
  4. I have a problem and I don't understand. I have a profield table with different fields and a select field. I did like it's instructed and put "value=label". But when I'm trying to output the select field with var_dump (to debug), it's indicated that the field is a string that contains the value. Why is it a string ? when I try myselectfield->value or label or title I have an error saying I'm trying to get a property on a non-object ... Anyone ?
  5. so i made some options in t he field type, and i want to check if selected title is that output this is my sample code if($media->r_soc == 'facebook') { $soc = 'facebook'; } elseif($media->r_soc == 'twitter') { $soc = 'twitter'; } i just basically want to check if the user in CMS selected option facebokk and then outpit it into variable which is later outputted into fa icon, oh and also this is all in repeat field foreach($ikonky as $media) { so thats why its $media, but as of now it outputs blank state, not sure why, it doesnt outpit anything none of the check goes throught these are options i have in the field 1=facebook 2=twitter 3=instagram 4=youtube 5=github 6=linkedin
  6. My client could save some time if she could select multiple pages at once. Of yourse, we are using the standard page selector in multi-tree mode, but she has to select one page after another. Each time she has to open the site tree again and open the required subtree, finding the page she wants to select. Would be cool to let the tree open after selecting a page, so she could select multiple pages in one "tree session". Understand what I mean? Anybody any solution to this? Alternatively, maybe the site tree could keep its state with all the subtrees open, when you are re-open it again.
  7. Going through my long quest to get better with ajax and utilizing the api, I have hit yet another roadblock. I currently have a form with an image field (thanks to flydev for getting that sorted), "title" text input, and a select field set to multiple. In my ajax call, I added in: tags = $("#select-tags").val(); form_data.append('tags', tags); $.ajax({ type: 'POST', data: form_data, contentType: false, processData: false, url: '/ajax/upload-preview/', success: function(data) { console.log("Woo"); }, error: function(xhr, ajaxOptions, thrownError) { alert(xhr.responseText); } }); And in the ajax template: $tags = $sanitizer->text($_POST['tags']); $image = $sanitizer->text($_POST['image']); $p = new Page(); $p->template = "preview"; $p->parent = $pages->get("/previews/"); $p->name = $title; $p->title = $title; $p->tags = $tags; $p->save(); If I select a "tag" from the select input and submit, it does indeed add it to the Page Reference field in the backend. However, this does not work with an array being passed to it of multiple options. So it does appear that my ajax call is trying to submit multiple options, but I am really just unsure how to get these two added in. I saw in other forums posts of add($page) and even add(array()). Do I need to handle this js array differently or do I need to foreach through the $tags to add it like: foreach($tags as $tag) { $p->tags->add($tag); $p->save(); } I tried this approach, but apparently I am still missing something. Edit: I was doing some tweaking, and I know I can split the js array out like: for (i = 0, len = tags.length; i < len; i++) { console.log(tags[i]); } However, I am not sure then how to handle the POST in php if I were to split it out.
  8. Hi everyone, here's the problem I'm trying to solve. I have a config area in my PW admin that is locked down for admin use. I use pages to store a bunch of settings that I'll use for my clients website. It's mostly used for visual things like colours and theming. This list could be tiny or large, depending on the sites requirements, but its great because I can store any information I want to. So the page tree could look something like this: ADMIN SETUP Home Config Aesthetics Colours Red Field: Custom Label - "Red" Field: Class name - "theme--red' Green Field: Custom Label - "Green" Field: Class name - "theme--green' Blue Field: Custom Label - "Blue" Field: Class name - "theme--blue' etc... Sizes Small Field: Custom Label - "Small" Field: Class name - "sm' Medium Field: Custom Label - "Medium" Field: Class name - "md Large Field: Custom Label - "Medium" Field: Class name - "lg" etc... Icons Target Field: Custom Label - "Hands shaking Icon" Field: Icon SVG - "[svg code]' Target Field: Custom Label - "Target icon" Field: Icon SVG - "[svg code]' Success Field: Custom Label - "Happy face icon" Field: Icon SVG - "[svg code]' etc... HOW I USE THIS I'm then able to set up page reference fields for colour, size and icons. I'll use these fields on particular pages so that my clients can select a particular colour, size or icon, or anything really. Currently, with the page reference field I can create a custom label for the options. So for something like colour I can label the field "Theme" and present a list of colours like "Red, "Green" and "Blue" using the custom page label label format of the colours page. This of course means that I can use this to do some lovely presentation on the front end of the site. With a colour selected I'll then be able to use the page reference to get the class name for that colour theme so that I can update the page's look and feel. So in my markup I'd end up with "theme--red" or "theme--green" etc. THE PROBLEM I have this all working which is great and it's really flexible for the client which they love. However, I'd love to be able to make things more visual for the client. Is there a way to be able to output more than just text in the page reference field? I might have a bunch of different blue colours, so instead of a list like so: Navy Blue Deep Blue Bright Blue Sea Blue ... it would be great to be able to output actual colour swatches, which is a lot mor visual for the client. Taking the icon selector, I would ideally like to show the actual svg that I've stored against that icon as a selectable image instead of seeing text options like: Hands shaking icon Target icon Happy face icon Just a couple of scenarios here, but as you can see there could be any number of reasons to display a more visual method of selection. ANY SOLUTIONS? I've looked at modules like FieldtypeColorPicker which could help in solving the colour issue, but it doesn't allow me to select a colour and then use a particular class name assigned to it the way I describe above. Considering the other use cases I mention above, does anyone know if anything exists already that would help me to create custom presentaion for page reference lists, or if there's anything planned? Thank you in advance for anyone who's read this far and has any words of wisdom! Dave
  9. So I was tinkering around with the "select fields" field type and added it to a repeater. My thoughts were I could have a user select a field (textarea, text, etc etc) that I defined and give it a name (another field in the repeater) and create their own form on the page. To be honest, I am now a little lost with rendering the form and mailing the results as potentially the form will be unique and custom every time. The only way I know to handle the output is by going about it this way: $forms = $page->form_select_fields; foreach($forms as $form) { if($form->name === "form_input") { //output input with custom name } elseif($form->name === "form_textarea") { //output input with custom name } } Is there a better way to go about rendering the elements from the repeater? As far as the custom sending goes, I am really at a loss since it would be pretty dynamic. Has anyone used this type of approach, and if so, how did you handle this without going insane?
  10. I don't know why multiple instances (repeater_repeat_columns1, repeater_repeat_columns2, ...) of my repeater field are displayed inside Template field (see image). Is there a way to clean/reset it ?
  11. I was wondering if there's an easy way to validate if a title is a valid value for a FieldtypeOptions field. I have created a field with different status values where only a single value can be selected: 1=done 2=planned 3=error Now I am going to update the page which includes this field which works fine so far - but: I I am using any other string than the defined options it stores a blank value. To avoid this I am trying to validate the input before. Something like getAllOptionsForField > in_array() etc would work but maybe there's a build-in method I am currently missing? Long story short: how would you validate if the given string is a valid option for a field? as usual: Thanks
  12. So I have been creating an internal web app over the last couple months, and am finally on the last piece of the puzzle, customizable forms. I thought I could just create a view basic forms and use a select option to let them select the form, and my template file could just output the form based on their selection. Easy enough. However, I have since ran into a slight head scratcher. Not all the forms are the same and they might vary greatly between each other. Has anyone done something similar to this? In an ideal world, I would use form builder, but I really dont want them to have access to it. They are currently constrained to a few pages in the backend, which is why I was trying to think of a way for them to select a few fields (like from a page select), and then render the selections on the front end based on what was selected.
  13. Does anyone know how to change the title of a select options to lower case? Right now, I have 3 options: "Management, Editor, Guest" (titles are uppercase in the backend), and I would like to change them to lower case in my template as I am adding them as a class name to span tags, ie "<span class="management"></span>". I will note, that I am using $level->title (the options) in a nested foreach loop, if this changes anything. Also, I thought I could use strtolower(), but it is just being "echo'd" in the source code.
  14. hey there, i'm using processwire for the first time, so maybe it's a dumb question. but i'm trying to have an options field which values are the users of the processwire. i don't need the values to be displayed, it's just for the administration of the page. but each time a new user is created / a user is deleted the options field should be updated automatically. is something like that possible?
  15. First, I want to thank everyone who has been developing this great CMS. I really love it and I can do so much more and even learn more about coding. Now I try to create something new and very important for me, but I have a small problem with it. I am trying to make a website where users only see their own stuff or blank / redirect if not logged in. The problem is that I want to use the same template for all users, so I can't put a certain page as parent for selectable pages because the parent should always be /clients/username/categories/ (different path for every user). Input field type is Select or PageAutocomplete. User can create new categories through it. I would also like to know if there is a way to prevent users to see only what they have under their own /clients/username without making new templates for all users. I only show what I want them to see through templates but if they know the admin url then they would see all the pages and they would have access to edit all the pages which are created with certain content type. They need only access to create new content under their own "main page". This user page is created when a new user is registered and linked with field (content of the field is user id). Select is very important because every category gives special view for user. user1 -- Project 1 ---- Year -------- Things that user creates from Page 1. -- Categories ---- Things I want to use as Select List for new pages -- Project 2
  16. I thought I had it figured out, but what I coded doesnt seem to be working at all. First let me set up what I am trying to do. Each page of the site has a different background color, so I was going to use a switch statement to just change the div class in conjunction with the Select Options Fieldtype, The switch: $switchColor = $page->switchColor; switch ($switchColor) { case "brown": echo "<div class='container inner-brown'>"; break; case "blue": echo "<div class='container inner-blue'>"; break; case "red": echo "<div class='container inner-red'>"; break; default: echo "<div class='container inner-green'>"; } I also set up a Select Options field type to be used on those pages, which is set to allow only 1 selection. However, it seems that it is failing somewhere and is defaulting to the "green". Did I not "select" the selection the correct way?
  17. Hey Guys! I ran into some really strange behavior when trying to save selected Selectfieldtype values from a form to a select field in a page. I have three different dropdowns in this page, all with different values and they randomly get saved en sometimes they don't. This is my setup: Form Page: Dropdown a: Dropdown a: - - V - - - V - Dropdown b: Dropdown b: - - V - - - V - Dropdown c: Dropdown c: - -V - - - V - I have no idea what is causing this since it happens completely randomly, does anybody have any ideas? Like, would it make more sense to only use a text field on the page side to recieve the value? and if so, why? Thanks in advance Gr, Bram PS: In the screenshot you can see the three filters that pick up the dropdown values and show the entries that are equal to the filter. And you can see the dropped values in the submissions.
  18. I have a page that has a field that contains a page. How do I use the API to update a page select field in the page's page? Example: User page has field "member" which points to a member page. Member page has field "gender" which points to page for selecting gender. How do I change the page the gender points to from the user page? I've tried $user->member->gender = 123; where 123 is the new page ID. Also, $user->member->set("gender", 123); Both of these seem not to work.
  19. how can I achieve something like this: in a custom process module ? I made a Interface(form) with the Inputfields components, but i don't know how to make the asmSelect to set the values so that it looks like above. At the Moment mine InputfieldAsmSelect looks like this in my alternative Interface: Here's the code which I have so far: $field = $this->modules->get("InputfieldAsmSelect"); $field->columnWidth = 50; $field->label = __("Titel"); $field->attr("id+name",'titel'); $fieldsTitel = $this->fields->get('titel'); $options = $fieldsTitel->type->getOptions($fieldsTitel); foreach ($options as $option) { $field->addOption($option->value, $option->title); } $valArray = array(); foreach ($entryPage->titel as $value) { $valArray[] .= $value->title; } $field->value = $valArray; $form->append($field);
  20. Hi folks, I am using the Select Options module to set up up options for content within a repeater (if the image you've added wants to be full, half or quarter width) and I have setup a few options: 1=Full 2=Half 3=Quarter This all works fine in the admin end; but on the front end I am trying to determine, for each in the loop, which options was selected. I have it set up like this: <div class="col-xs-12 <?php if ($image->issue_raw_image_width === 1) : ?>col-sm-offset-1 col-sm-10<?php elseif ($image->issue_raw_image_width === 2) : ?>col-sm-6<?php elseif ($image->issue_raw_image_width === 3) : ?>col-sm-3<?php else : ?>not-working<?php endif; ?>"> However, this isn't working at all; it just echos out my test 'not-working' class. If, for each, I ask it to echo out `$image->issue_raw_image_width` then it returns the correct value. Any thoughts?
  21. Hello Processwire Community Lets say i have a pagefield called select_organiser. The select_organiser pagefield is assigned to the user template and to the location template. Every User can create a location where he can set a organiser with the select_organiser pagefield. The Superuser can also create locations and he can assign a organisation to a user. No what i want is that the pagefield should check if the current user is a superuser, when yes he get a selection of all organiser pages. But when the current user is not a superuser he should get only a selection/select of the organiser that the Superuser has assigned to him. for example: organiser pages: organiser-example-1 organiser-example-2 organiser-example-3 organiser-example-4 ... users: test-user-1 test-user-2 ... Lets say I am the Superuser and i assign organiser-example-1 to the user test-user-1. Use Case: Create Location as Superuser I have a select with the selection: (organiser-example-1, organiser-example-2, organiser-example-3, organiser-example-4 ...) Use Case: Create Location as test-user-1 I have a select only with the selection: (organiser-example-1). This means I can only create Locations with the organiser: organsier-example-1. I hope you understand what i want to say/ask.
  22. I'm trying to achieve a specific selection for a pagefield for specific users. My pagefield should detect: If the current user is a superuser return all address-pages and when it's not a superuser, return all address-pages which the current user has created. It works fine for the superuser but i have no selection in all the other users. if(wire('user')->isSuperuser()){ return $pages->find("template=address"); } else{ return $pages->find("template=address, created_users_id=wire('user')->id"); }
  23. Hi folks, I have a repeater set up on a page and wondered if it's possible to only return the repeater rows that have a certain 'item' selected from a dropdown select field? So, for example, on my dropdown select I have two options 1: Article and 2: Sector guide, and I can return each row of the repeater easily enough with: <?php $articles = $pages->get('/practice/publications/'); ?> <?php foreach ($articles->practice_publication as $article) : ?> <?php echo $article->practice_publication_title; ?> <?php endforeach; ?> But this will of course return all the repeater fields, whereas I need it to only return the fields which have the practice_publication_type=1, for example. I tried looking around for the answer to this but couldn't find anything. Maybe it's not possible... Cheers, R
  24. I created fieldtype "select" for template (0:=Prepared, 1:=Done) And need to make for list of pages with this template value for this fieldtype to "1" from. There are to many pages to do it manualy. How to make it?
  25. Hi folks, As the title suggests, is it possible to output the label from a select/dropdown, rather than the value? I am using this module: http://modules.processwire.com/modules/fieldtype-select/ and I am currently outputting the value as follows: <?php echo $project->project_location_type; ?> Thanks in advance, R
×
×
  • Create New...