I am trying to find a good way to have a dropdownlist by specifying UiHint "DropDown" to the property of the ViewModel and then just using HtmlHelper EditorFor to render the dropdown via an generic EditorTemplate so that it can be used across solutions. I found a very good approach by Tom Schreck Here It works fine. The only thing from keeping it from being perfect is that the dropdownlist is not part of the validation. If I would like to have a "choose" option (added manually in the EditorTemplate) as default and no value is chosen it results in an error. I believe it's because the DropDownList is not created from the DropDownListFor - Helper? I know that Tom wrote that he tried that one, but is there no way of adding items to the SelectList in the loop with the custom values? I cannot do it since I'm a beginner but I think it would be really great if the dropdown could be inlcuded in the validation. This way you could populate the selectList in the controller and keep the same format as the other properties. Sorry for my vocabulary, as I said, I'm a beginner. But I hope you understand what I mean.
I would really appreciate if someone helped me to solve this as I feel I have tried everything..
Regards max
Related
I am trying to build my first own extension with the Extension Builder. Up to now everything worked really well, but now I've got a problem and am not able to find a solution:
My extension looks like this: You can add new Entries in the backend under List (the entry on the right panel). These entries are then shown in the frontend.
While adding new entries there is the possibility in the horizontal navigation bar to link this entry to specific categories. I've already done this with every entry.
But how can I display this category in the fronted. It should be just one <div> like Linked Categories: CATEGORY.
It seems like there is no ViewHelper which can display all linked categories.
I've already googled a lot, but this just confused me more: It seems like its not possible with a simple ViewHelper. There was a solution, where one had to edit the controller. But I did not like this because then I can not continue working with the Extension Builder or it becomes overwritten.
I also looked in the code of tx_news. It seems like all categories are in a variable there, which can be looped. But in my extension <f:debug>{categories} was always NULL.
Is there no ViewHelper which can display the categories, or anything else? Maybe a good tutorial (I am good in PHP, but new to TYPO3).
Thank you very much in advance,
Felix
P.S: I am using TYPO3 CMS 7.6.9
the Extension Builder is just a 'kickstarter' that helps you define your models and actions, relations etc ... It will not do more then that. So once you created your extension draft, it's best to forget about the extension builder and try to understand the structure of an extbase extension (the MVC, TCA, localconfig, typoscript,...). If you need to add a new property, do it manually. You will learn a lot more about your extension and how it works.
Having this said, you will have to adjust your extansion yourself to add categories. There are a few ways to do it: you can add your own category system by adding your own category Model, or use the TYPO3 category API
https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Categories/Index.html
There is also no plug&play category viewhelper. If you like to be able to list your entries by category, you will need to adjust your controller.
You can add some functionality to an existing on, for ex. your listAction so that it reads arguments send to this action (a list of categories you like to filter on) or create a new one called for example categoryAction.
extbase reference :
https://docs.typo3.org/typo3cms/ExtbaseFluidBook/b-ExtbaseReference/Index.html
stackoverflow question about categories in a controller:
Controllers and Template (how to filter results correctly or give arguments via backend?)
bottom line:
- skip extension builder
- learn how to adjust the MVC yourself
you can always join the TYPO3 slack channel :
https://typo3.slack.com/
it's free and people are very helpfull
good lcuk
I have made a new from, but i want to remove the titles which are displayed before the input fields. I can't really understand how to edit placement.info file, so any help would be appreciated.
Thanks
You probably need to have a look at this: Alternates
Enable the Orchard Designer Tools Module, drill down to your Form and edit or change what you need.
I am creating a slightly elaborated form with Angular. This form can be submitted, then modified or simply displayed (with everything in read-only for example).
For now I have 3 templates with 3 controllers for each action (submit / edit / view) and the form is added as a partial (ng-include). The form has also its own controller. Is it the right way?
Also, should I make the form's controller the children of the templates' controllers or the opposite? I am using the same model for each action behind the form and I guess it should be injected through the template's controller.
It's my very first attempt to do this and I would like to have a few advice's and hints since I am afraid of going the wrong way. Thank you!
yo can use different template for each of them with single controller, different controller for each of them is not a good idea because there may be some common function in them then you need to write that function in each of them.
you can use common model for them,i am doing the same.
I see this is promising solutions to what you are looking for
can you try this http://vitalets.github.io/angular-xeditable/#editable-form
I need to implement a multi-select combobox using SWT/JFace, What would be the best approach?should i go for changing the source code or i should try to extend the combo?
It is not possible to extend a Combo It is possible to extend Combo by overriding checkSubclass(), however it is highly disapproved of. The alternative is to create a wrapper for it. But that would be too much work.
Extending a CCombo is an option, but not a very good idea. Again, too much work for the functionality you need.
BUT
As sambi reddy mentioned, you could use a TableComboViewer from Nebula (scroll down to "TableCombo").
Another convenient solution (my favorite) is to have a CheckboxTreeViewer since you need to implement multi selection and such.
screenshot
https://github.com/lawhcd/SWTMultiCheckSelectionCombo
For anyone who is looking for a widget that allows user to select multiple options from a list of check box style options.
It is based on user1438038's idea and extended to provide nearly all of the api required of a widget similar to Combo.
in my current asp.net mvc project I'm using the built in functions for displaying resourcebased text as headers for my textboxes and stuff. In Create and Edit views this is accomplished by using the HtmlHelper LabelFor method like this:
Html.LabelFor(model => model.InternalTitle)
BUT, the default in the asp.net mvc 2 template is List views (that generates a table based on an IEnumerable<>) is the headers hardcoded like this:
<th>InternalTitle</th>
Is there a nice way to get the same result as in the Create and Edit views here aswell?
I have looked at the LabelFor<> method but cannot figure of how to make that work.
Of course i could just use the Resource property that is used on my domainmodelproperty. But i think it will look even better if there was some way to use the LabelFor method or something similar.
I do not want to invent the wheel once again by implementing my own reflectionbased helper method and i think that this should be in there by default, or at least i hope so....
To get the display name of a model property you should call ExpressionHelper.GetExpressionText.