Jump to content

Search the Community

Showing results for tags 'asmSelect'.

  • 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 8 results

  1. Is there a way to add a (new or existing) page to the top of the asmSelect list? By default they're added at the bottom.
  2. I want to add a few pages to an AsmSelect Page field inside a repeater using the following code: $trialsPage = wire("pages")->get(28422); // Get the page $trialsPage->of(false); $newTrial = $ordersPage->trial_repeater_orders->getNewItem(); // Add item to repeater foreach ($selectedProducts as $selectedProduct){ $productPage = $pages->get("template=product, reference=$selectedProduct"); $newTrial->trial_selected_products->add($productPage); } $newTrial->save(); $trialsPage->save(); However, when I check the page where the field is located it doesn't have the new values as expected. The selected pages exist, the field is in the right location, made sure that the output formatting is turned off: $page->of(false); But it still doesn't work with a variable. No matter what I try, it doesn't work. It only works when I replace $selectedProduct with a hardcoded string. Am I doing something wrong here?
  3. I am trying to create an input field type InputfieldPageListSelectMultiple in a module, but for some reason, it doesn't quite work as expected... (abbreviated) code: $this->addHookAfter('ProcessPageLister::renderResults', function ($event) { $out = ''; if(wire('page')->id === 1224) { // the particular Lister instance page id $form = wire('modules')->get("InputfieldForm"); $field = wire('modules')->get("InputfieldPageListSelectMultiple"); $field->attr('name+id', 'current_selection'); $field->attr('class', 'InputfieldAsmSelect'); $field->label = 'Your current selection'; $field->derefAsPage = FieldtypePage::derefAsPageOrNullPage; // this part works - $total is taken from a session variable if($total) { $sel = $total["selector"]; $myPages = wire('pages')->findIDs($sel); foreach($myPages as $k=>$v) { $field->attr('value', $v, wire('pages')->get($v)->title); } } $form->append($field); $myForm = $form->render(); $event->return = $myForm; } }); What I get is this: I can't drag and drop, the layout is not correct (trashcan should be on the right), and I also can't delete. Furthermore, I see a textinput with the page IDs underneath. Why? Oh, and also: the first item is "Label" o_O I've googled, and looked at Ryan's code, but I guess I'm missing important stuff. (if you're wondering: I'm trying to do a little proof of concept that would (partly) solve this question here)
  4. Hello, I have a page field type (Multiple pages(PageArray)) with the input field type as AsmSelect. The admin users can select one or more pages from a list in the admin area. Some of those pages have children and if a checkbox is selected and the parent page has been added to the list, then I want to add the child pages as well on page save. So in admin.php I am trying to set those id's, but I can't get them to save. Hopefully the code clears up what I am trying to do. I appreciate any assistance. $pages->addHookAfter('save', function($event) { $pages = $event->object; $page = $event->arguments(0); //check if on template if($page->template == 'item') { //is the checkbox checked to add children if ($page->add_children == 1) { //get the values in the page field type field foreach ($page->page_assignment as $child) { //if selected pages have childen if ($child->numChildren > 0) { //loop through those children foreach ($child->children as $grandchild) { //set values. //$page->set('page_assignment', array($grandchild->id)) $page->page_assignment = array($grandchild->id); //we got the id of the page we need to s $pages->error($grandchild->id); } } } } }
  5. Hello, I'm coming back to you since I've finally managed to extract the 'buggy' part of my code. Here's my problem : When a player loses a level, I want this player to lose all his equipment, so I wrote : foreach ($player->equipment as $equipment) { $equipment->delete(); } But here's what happens : The original equipment pages get deleted ! Not just the item in the AsmSelect ! And I just can't figure why this happens ! Yet I'm sure I am misunderstanding some basic principle here... So if anyone could give me a hint, I'd appreciate. To be more precise : my equipment list is in my tree in equipment/weapons/ and has many pages, such as sword, bow, gun... (It looks violent but it's not, it's a classroom experiment to motivate teenagers ) and my AsmSelect resides in a player template so whenever a player has the possibility, he can select an equipment page. Everything works fine, except when I use this 'delete' line In other words, how could I clean this asmSelect without actually deleting the pages in the original equipment tree? Thanks in advance !
  6. I found no way to add text "Please select..." as the first item to an AsmSelect field. Using PHP I could add a disabled option but an empty first item is always prepended to the options list. I also checked the JavaScript options but found no way to do this. Is there something I overlooked? I can add this feature with a few lines of extra JS but it would be better if there were an "official" way.
  7. I need to make a quick and easy way to access the edit page for page selects, usually with AsmSelect; so far i have been able to use this jquery to turn the label for the AsmSelect into a link to the page editor for that selected page, but i can't figure any easy way to make it into a modal.. anyone else tried to do this yet? $(function(){ $('div.InputfieldPageAutocomplete ol li').each(function(){ var id = $(this).find('span.itemValue').text(); $(this).find('span.itemLabel').wrapInner(" <a class='edit-modal' href='"+config.urls.admin+"page/edit/?id="+id+"' target='_blank'></a>"); }); }); adding this with the AdminCustomFiles assigned to process page edit..
  8. Hi all, i have some problems when trying to add more pages with asmSelect. I have a field called "categorie" that contains an array of pages ( imagine the behavior of categories ). If i try to add one page from that field all works fine, if i try to add more than one page i get this error: I found that "1007" is the id of the default language. Maybe could be useful for reproduce this error. The field config is like this: There is something that i am missing ?
×
×
  • Create New...