What html form control is used in adding multiple value field? - html

I have making a simple jsp app and i have a many to many relationship between song and genre. What form field should i use to add multiple genres to a song. I am thinking of check boxes but i don't know if it is appropriate. Here is my erd.

If the goal is to select multiple options, checkboxes would be the best option.
Radio and <select> would only select one.
W3 Schools: <input> Tag

A multi-select dropdown will suit best here. And I suggest Select2 (https://select2.github.io/) if you're using jQuery in your project.
Regarding manipulating the values, I suggest use JSON. You can get selected Genres from Select2 as an array. Just bind like this
[
{
"song": "<song_name>",
"genres": "[select2 values in array]"
},
..
]

Related

How can I change the input received by clicking in a datalist?

I have a datalist that shows the autocompletion of some fields how can I make sure that the input is only a part of that selected field??
You can solve this problem by defining a variable of type number.
After selecting from the input, add a number to the variable and using ngIf in html or if in ts, Control the number of choices.
I assume that you have Street Names in the dropdown and that object also includes street information as well (maybe in some other variable). So you want user to search using the street information as well but in the dropdown you just want to show the user Street names? if that's the case,
you can do something like this:
<datalist>
<option>
{{streetName}} <span style="display:none">{{streetInfo}}</span>
</option>
</datalist>
This way your street information wont be shown but will filter the result on basis of stretInfo as well.
hope it helps.

How do you implement custom autocomplete list in html?

I am trying to understand a simple auto-search result textbox.
Now, I have setup javascript events to make the ajax call and fetch the search result from the server, as the user types a string in the textbox, and store it in an array. So, I have a javascript array that contains my search result.
var searchResult = [
"Accordion Company",
"A Little Mouse",
"Another Time",
"ASIO"
];
I want to attach this list to some property(or something else) of the textbox so that my list appears as a dropdown as the user types.
Does a textbox even allow that? What HTML control/property allows the autocomplete list to appear?
Background:
1) I have worked with jQueryUI and all of this can be achieved very easily there. I am interested in learning how is the inherent property of a textbox overriden to show the autocomplete result? If I strip down everything to simple HTML and javascript how is this achieved? Or is it just an HTML/CSS trick that looks like a dropdown
2) I have looked into vCard too but couldn't figure out how will I override a vCard array with my javascript array that contains the search result.
Just trying to understand whether I can tell my INPUT type="text" control to show a custom autocomplete list.
Thanks!
There is the list attribute and the associated datalist tag
<input list="things">
<datalist id="things">
<option value="Some">
<option value="No">
<option value="Any">
</datalist>
You can take your array and build a datalist element.
datalist is html5 so support might be a problem.

GWT: How to group related fields in a UIBinder form?

What is the approach to group related fields in a large UIBinder form in GWT? The field group has a title and should allow optional selection of the entire group to appear/disappear or be enabled/disabled.
UPDATE: DisclosurePanel looks fine but does not mix well with custom CSS layouts and I do not want to use other widgetsets.
Is DisclosurePanel what you're looking for?

VBA Multiple Objects with 'With' Statement

I have a check box that when checked multiple boxes are disabled on my form.
Currently im using
With Me!Textbox
.Locked = True
Is there a method where I can list multiple objects within the With statement rather than writing out each time for every textbox
e.g.
With Me!Text1, Text2, Text3
It may be easiest to add something to the tag property to identify the relevant controls, "lock", say. Then you can iterate over the controls collection and lock anything with a tag set to "lock".

to validate checkbox input for table using multiple rows

i using js to add multiple row in a particular table, but when submit the form all check box having the same value, so how can i validate this checkbox using js before submit so change value to if unchecked, i trying on that but got no solution, does any one this before,
thanks in advance
What are your checkboxes called? Do they all have the same name? You have two options. One is giving each checkbox an unique name, the other is giving your checkbox a name like checkboxes[]. The [] lets all the values be entered into an array so they don't overwrite eachother.
If you mean something else, you have to state more clear what you want, because it's a bit incomprehensible right now.
finally i found solution for my problem, thanks 'vindia' for the clue, i add checkbox with array, sol as below
in html
`<input id="abc[]" name="abc[]" type="checkbox" value="1">`
in js
for(var i=0;i<chkDefaultLength;i++){
if(!document.neworupdateevent["chkDefault[]"][i].checked){
document.neworupdateevent["chkDefault[]"][i].value=0;
}
}