Midnight Modding Posted April 27, 2018 Posted April 27, 2018 Any suggestions on the best way to use the table helper and have its rows include form elements within a form created with the form helper? I can't think of a good way to use both helpers together and the only way I see any form integration in the first party phtml files is where they just create the form themselves without the helper. Am I best off just doing my own form html like that? All I am even adding is what would be a Number field, so that's not so horrible to just do myself, but ti's so nice having all the validating built in by using the helper. lol. While thinking about it I half way come up with ideas, but then think of a problem making it work, such as trying to do the form within my Table.php file. I assume I couldn't get a $values = $form->values to work on the redirect because the table helper is setting up the table, but for the form to validate it would need to have the fields, which are not yet created until the table code is executed.
bfarber Posted April 27, 2018 Posted April 27, 2018 Do you need to actually use the table helper? The Matrix form helper is designed to facilitate a column/row sort of form layout, and is probably better suited for what you are attempting to do (without actually knowing what you are attempting to do).
Aiwa Posted April 27, 2018 Posted April 27, 2018 Sounds line a prepopulated matrix with an an additional blank field for entering your number. I don't see the table helper being of much use to you here either.
Midnight Modding Posted April 27, 2018 Author Posted April 27, 2018 Originally this page was for displaying a table of data only. So I already used the table helper and finished that. But, later, I realized something I was going to do with a form elsewhere could just be done by adding one field per row in that existing table. Kind of like topic listings, where the main goal is to display data, but it does have options to do things with the topics. I guess it's possible a matrix could help, but this is one of those situations where to normal members it's just for data displaying purposes, so obviously in that situation it wouldn't need a form field. I know many ways I can handle it. But I'm leaning towards either just manually putting the form html in the template or having a whole separate form, as it may not really need all of that data to begin with, so may be better off separate. (ie the table needs to display more than the form really would need, but just figured it would be convenient if built into that table)
Aiwa Posted April 27, 2018 Posted April 27, 2018 Use rowButtons then and let the admin click edit to modify the row.
Midnight Modding Posted April 27, 2018 Author Posted April 27, 2018 It's more to it than that. It's something that involves editing multiple rows at once. Btw, will 'FIELD()' work in sortBy? I've already had to do some odd workarounds in the table helper, involving sorting.
bfarber Posted April 30, 2018 Posted April 30, 2018 You can create more complex sort by's, yes. As for the form, you could model what you're doing after multimoderation I suppose.
Midnight Modding Posted April 30, 2018 Author Posted April 30, 2018 Thanks. The client really wanted it like it was in 3.x, anyway, so I just stopped fooling with it this other way. I do wish I could have got my situation to work with a Stack, though! This was all for reordering and stacks have that nice drag/drop reordering, but I would have needed it where you can't edit the actual contents, you just change the order, and I guess I could have done it with some custom form input, but it just wasn't worth the time right now, since he didn't care about it, anyway. (for stacks you can only set the filed type, not do options for that field type, otherwise I could have set disabled... there were more issues to come after that, though, even if that had been figured out.)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.