Posted January 2, 20196 yr Hi, I'm pulling my hair out trying to construct a form Stack with \Helpers\Form\Member fields... new \IPS\Helpers\Form\Stack('mystack', array(), false, array('stackFieldType' => '\IPS\Helpers\Form\Member', 'maxItems' => 20)); When adding a new stack row, it looks like several Member autocomplete fields are added in a same field: Apparently, the javascript in ips.ui.stack.js doesn't manage to handle the situation. Am I doing something wrong, or the Stack simply doesn't work with Member fields? Or is it a bug? Thank you! Edited January 2, 20196 yr by LaCollision
January 2, 20196 yr Why not just use a member field that allows multiple entries? What's the use case for a stack?
January 2, 20196 yr Author 9 minutes ago, Aiwa said: Why not just use a member field that allows multiple entries? What's the use case for a stack? I'd like to create a team of members: each member would have a role in the team. So, actually, the Stack would be used with a KeyValue field type, like the \core\Form\SocialProfiles field type. Except that I would use a \Form\Member field type inside, instead of a simple URL field type 🙂 A team would be something like that: => Several members, with a role for each. I'd like the first field to be a Member field with an autocomplete… 😭 Edited January 2, 20196 yr by LaCollision
January 3, 20196 yr Author 13 hours ago, Aiwa said: Have you tried using Matrix instead? Thanks for the idea! But unfortunately, adding Member fields in a Matrix looks very very buggy 😭
January 3, 20196 yr Author 1 minute ago, Aiwa said: Mind showing your code to build the form? Something really simple, like: $matrix = new \IPS\Helpers\Form\Matrix; $matrix->columns = array( 'member' => function($key, $value, $data) { return new \IPS\Helpers\Form\Member($key, $value, false, array()); }, ); $form->addMatrix('members', $matrix); But I'm new to the Matrix, so 😅
January 3, 20196 yr What you've got is right, not working for me either... Swapped out a Text field for a Member field on an existing app I wrote, I get the same result as you. I'd submit a ticket and report this as a bug. While you might catch a little grief from T1 since it's 3rd party app related, it's something IPS devs need to hear about.
January 3, 20196 yr Your chances to be heard will increase if you got this topic moved to https://invisioncommunity.com/forums/forum/504-ips-development-gateway/
January 3, 20196 yr Author 16 minutes ago, Aiwa said: What you've got is right, not working for me either... Swapped out a Text field for a Member field on an existing app I wrote, I get the same result as you. Thank you for having taken the time to look into it 🙂 That's funny, my need is exactly the same as yours: giving a member a role (like Administrators in your screenshot). In your current form, in the member name field (the 1st field in your columns), you need to type the exact name of the chosen member to make it work? 16 minutes ago, Aiwa said: I'd submit a ticket and report this as a bug. While you might catch a little grief from T1 since it's 3rd party app related, it's something IPS devs need to hear about. Yes, I just opened one. Thanks! Edited January 3, 20196 yr by LaCollision
January 3, 20196 yr 8 hours ago, LaCollision said: In your current form, in the member name field (the 1st field in your columns), you need to type the exact name of the chosen member to make it work? The first column is text, won't contain a member name. It's used to match a string from an external system (that is a source of truth) and assign a member group based on that admin controlled string. I didn't do much testing when it was a member field to see if the auto complete worked.
January 3, 20196 yr Stack doesn't work with any form field that requires javascript. You can't stack a node field either.
January 3, 20196 yr 2 minutes ago, HeadStand said: Stack doesn't work with any form field that requires javascript. You can't stack a node field either. This topic gave me an idea of using a matrix in a popuptemplate, yeah... Matrix has the same problems when it requires javascript. It'll render the initial form, but the add button doesn't add rows, it redirects.
Archived
This topic is now archived and is closed to further replies.