Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7791583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:55:52+00:00 2026-06-01T21:55:52+00:00

Put it simply: I’d like to let the user to select some tags in

  • 0

Put it simply: I’d like to let the user to select some tags in JS and submit it to my controller. Here are my suggestions:

  • Create a hidden input for every inserted tag with naming convention like: Tag123 (123 = this tag’s unique identifier) and iterate through FormCollection in my action method to find out which tags have been selected. Cons are obvious: using FormCollection instead of ViewModel and iterating through the FormCollection to get my desired data seems bad to me.
  • Create one hidden input and append every selected tag to it. This can become messy on tags deletion since I should find the right id from the input’s current value and delete it. But the Pro is that I only have one element and can put it in a viewmodel to access it in controller action.
  • Curious to see if anyone knows how SO does it. They’re kind of defning the standards now. Would love to know how they do it.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T21:55:54+00:00Added an answer on June 1, 2026 at 9:55 pm

    I have a website running with the option of adding tags, much like SO.
    My approach to the problem, however, led to me create one input field for each added tag, and increment a javascript index variable every time a new input is added, then making use of a ViewModel to bind a IList<TagDTO> tags { get; set; } (forms tend to get complex over time anyway, so a viewmodel is almost always a good way to go). Here is an example of the html hidden inputs created in the page:

    name=tags.Index, value=0
    name=tags[0].tagid, value=201
    name=tags.Index, value=2
    name=tags[2].tagid, value=307
    

    This has one great advantage to me: Internationalized tags and possibly disallowing nonexistent tags.
    What I mean is that every tag has an ID, and in my “Tags” table in the database there is one column for the name of this tag in each language I support. Such as:

    tagid | name_ptBR   | name_en
     201  | animais     | animals
     307  | educacional | educational
    

    This is only my approach to the problem, but it has worked out ok so far.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Put simply, I want to select all data in two columns from each of
Simply put, if the input is always in the same case (here, lower case),
Simply put, when a user wants people to be able to go to their
Clarification: Put simply, I'd like to put an ASP.NET UpdatePanel inside the info window
Simply put, I am trying to create a custom logger for visitors to a
Simply put: Is there any way to create non-modal JFace dialog? I've tried calling
Simply put, is there a way to create a 2D javascript array using similar
Put simply about Table Data Gateway (TDG) implementation: you create separate TDG class that
Simply put, I would like to make java do what I want but I
Put simply: it causes a massive memory leak within an hour if I work

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.