[CLOSED] No TagFieldFor??

  1. #1

    [CLOSED] No TagFieldFor??

    Hi guys.

    Is there any way to assign a model to the TagField component such as the comboBoxFor component?

    Example:
    Html.X().ComboBoxFor(m => m.key)
    If this is not possible, is there any way to modify the model before making a shipment with the TagField values.

    Regards.
    Last edited by fabricio.murta; Jun 23, 2017 at 7:12 PM. Reason: no feedback from the user in 7+ days
  2. #2
    Hello @dlanza!

    Well, short answer would be that simply the TagFieldFor extension builder method was not implemented at all. I believe that wouldn't be a problem at all to implement... But maybe I'm missing the correct scenario where it would fit... Look at this test case:

    @{
        Layout = null;
    
        var AllEntries = new List<ListItem>()
        {
            new ListItem() { Text = "One", Value = "1" },
            new ListItem() { Text = "Two", Value = "2" },
            new ListItem() { Text = "Three", Value = "3" }
        };
    
        var SelectedEntries = new List<ListItem>()
        {
            new ListItem() { Text = "One", Value = "1" },
            new ListItem() { Text = "Three", Value = "3" }
        };
    }
    
    <!DOCTYPE html>
    
    <html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <title>Index</title>
    
    </head>
    <body>
        <div>
            @Html.X().ResourceManager()
            @(
                Html.X().TagField()
                    .Items(AllEntries)
                    .SelectedItems(SelectedEntries)
            )
        </div>
    </body>
    </html>
    The view controller would just be public ActionResult c61933_TagFieldFor() { return View(); }
    Bundled the model in for simplicity.

    Hope this helps!

    EDIT: I believe the code you suggested Html.X().ComboBoxFor(m => m.key) will be but a syntax sugar for Html.X().ComboBox.SelectedItems(Model.key)
    Last edited by fabricio.murta; May 24, 2017 at 9:18 PM.
  3. #3
    Hello, I have tried your suggestion to use the SelectedItems method passing it as a Model.key value but not full solution to my problem.

    With this solution I can assign default values ​​to the TagField component but if I make changes like selecting new values ​​or deselecting the default values ​​through the user interface on the component they are not reflected in Model.key when I send the form as if it does ComboxFor (Model.key).

    Eample
            @(
                Html.X().TagField()
                    .Store(
                        Html.X().Store().Model()
                    )
                    .SelectedItems(Model.key)
            )
    Any solution to archive this?

    Regards.
  4. #4
    Hello @dlanza!

    Would you mind providing a full test case reproducing the issue you are getting on your side, maybe showing a working combo box and the non-working tagfield in the same form, and how you can't get it in your code? If we understand the whole scenario we could better understand what needs to be done here.
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Hello again, @dlanza!

    It's been some time since we last posted a follow-up here and still no response from you. We would love to be able to reproduce the scenario you're facing so we could best plan on the fix or feature that would be necessary to make the TagFieldFor to work for good.

    If we don't receive a feedback from you in 7+ days, we may be marking this thread as closed. But don't worry, you will still be allowed to post back here when or if you get able to.

    We're looking forward to your use case scenario!
    Fabrício Murta
    Developer & Support Expert

Posting Permissions