Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Midnight Modding Posted August 18, 2018 Posted August 18, 2018 This is for a form in the acp. $form = new \IPS\Helpers\Form; $number = 1; foreach( $js as $j ) { if( $number === 1 ) { // Tab 1 $form->addTab( 'something' ); } elseif( $number === 2 ) { // Tab 2 $form->addTab( 'somethingElse' ); } $number++; foreach( $px as $k => $v ) { $form->add( new \IPS\Helpers\Form\Number( 's_' . $k, $pD[$v['t']['j_id']][$row->la]['b_ks'], TRUE, array( 'min' => 2 ) ) ); } } if I do that, where it has 2 tabs, it shows none of the form inputs in them! It only has the save button in each tab and that's it. If I get rid of that elseif, where it only has 1 tab set, it doesn't show the tab, but it correctly shows all form inputs. What's going on? I've done forms with tabs many times and this has never happened. ps yes I do have an array like that one for the default (lol), I just change naming in this since it's a private project.
Midnight Modding Posted August 18, 2018 Author Posted August 18, 2018 I figured it out... In the example above, I have keys for those tabs. in my real use of this, I was calling addToStack(), because I needed to use sprintf in it. The tab method can only accept keys. Unless someone knows a better way... to get it to work I set \IPS\Member::loggedIn()->language()->words['something'] to the string I wanted, where I could use sprintf, and then passed the key 'something' to addTab().
bfarber Posted August 20, 2018 Posted August 20, 2018 This is why it's better to share the actual code instead of pseudo-code. We could never have looked at what you posted and guessed the real issue.
Midnight Modding Posted August 20, 2018 Author Posted August 20, 2018 8 hours ago, bfarber said: This is why it's better to share the actual code instead of pseudo-code. We could never have looked at what you posted and guessed the real issue. I know. It's just that it's a project under NDA, so I have to change some wording up and it didn't occur to me it could be related to what I passed there. I guess from now on I need to just change wording without changing the code part itself. ?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.