Selecting a default radion button in d3 from button event - d3.js

I'm using d3. I have a radio button group called #risk. This includes values "apple", "Orange", "Lemon".
I have a separate button on the screen which resets the value back to "Apple". So if they select "Lemon" then click reset, the new value will be "Apple". Any idea how I would do this. Having some difficulty achieving something that should be pretty trivial.
Here id the radio button code:
<div id="risk">
<form>
<span>
<input type="radio" class="risk" name="mode" value= Apple">
<label> All</label>
</span>
<span>
<input type="radio" class="risk" name="mode" value= Orange">
<label> All</label>
</span>
<span>
<input type="radio" class="risk" name="mode" value= Lemon">
<label> All</label>
</span>
</form>
And here is the code for the update button:
d3.select("#resetChart")
.on("click",function() {
d3.selectAll("#risk").selectAll("input") //somehow make this select a radio button
});
My last edit was rejected. I'm not sure on what basis. If this doesn't fit the criteria could you please let me know what I need to do to improve it? Many thanks :)

Related

How to get read of automatic checked radio button in a Boolean data type in Thymeleaf, Springboot?

Im using spring-boot back-end with the fontend thyme-leaf . But the problem is when im putting Boolean data type in a radio button then the value which is set to 0 is automatically checked in the font end, event if i try to add th:checked="unchecked" its not working. My code is given bellow
<div class="form-group">
<label for="isDownloadable"> Is Downloadable</label> <br>
<input type="radio" th:field="*{isDownloadable}" value="1" th:checked="checked">Yes
<input type="radio" th:field="*{isDownloadable}" value="0"> No<br>
</div>
As here iv tried to cheack Yes radio button but its checked the No radio button in the front end.How to solve this problem ?
here is the output of my code given
If you want to use 0 and 1, you put need to condition and show data.Solution is
<div class="form-group">
<label for="isDownloadable"> Is Downloadable</label> <br>
<input type="radio" value="1" th:checked="${history.Shift == 1} ? ${true}">Yes
<input type="radio" value="0" th:checked="${history.Shift == 0} ? ${true}"> No<br>
</div>

How to use multidimensional checkbox v-model in vuejs

Suppose i have some subjects which has conditions and groups.
How can i load those first time and checked in update mood in vuejs?
<div v-for="(sub, Index) in subjects">
<b>{{ sub }} </b>
<label v-for="(subconlist) in sub['subCon']">
<input type="checkbox"
:value="subconlist.id"
:key="subconlist.id"
>
<span>{{subconlist.name}} </span>
</label>
<label v-for="clsgrlist in sublist['acGr']">
<input type="checkbox">
<span>{{clsgrlist.academic_group_name}} </span>
</label>
</div>
<button #click="saveOrUpdate()" >Save </button>
</div>
fiddle here
the table where i will save it : sub_id,condition_ids,group_ids
I have to save data based on checked value in the table with comma separated.
How can i get checkbox checked if it already found in the table, i mean when update?
I need to get subjectconditon or group ids basis on each subject when click on save button.

slick slider formular tab switch from one slide to another

i'm using slick slider for a large formular. Each section is one slide.
<form>
<div class="form-slider">
<div>
<h2>Section 1</h2>
<input type="text" name="eins"><br>
<input type="text" name="zwei">
</div>
<div>
<h2>Section 2</h2>
<input type="radio" name="drei">Drei A <input type="radio" name="drei">Drei B<br>
<input type="text" name="vier">
</div>
</div>
JS:
$('.form-slider').slick({
dots: true,
draggable: false,
swipe: false,
nextArrow: $('.btn_next'),
prevArrow: $('.btn_prev'),
adaptiveHeight:true,
accessibility: false
});
My Problem is now, that if the user use tab to switch from one to another input field, the slider doesn't slide well, it only slides half of the next div. I tried to turn off the tab-function (by adding tabindex="-1" on each input) but this doesn't work on safari high sierra! and it's not really userfriendly.
Example: https://www.accuro-funds.li/test/
Thanks for help.

Click a input type submit - Mechanize Ruby

I am trying to click a button which is actually a submit without a form which looks some thing like this and store the result in an object
<div class="searchBar-input">
<input id="front-page-search" value="Enter Keyword(s)" type="text">
</div>
<div class="searchBar-submit">
<input id="searchBtn" value="Search" type="submit">
</div>
I have tried puts page.forms and I am getting nothing as there is no form on the page. Its just a text box whose value I have to submit.
I have googled but I found everything about form submit and links. How can I click this? Any suggestions.Thanks in advance
try this :
<div class="searchBar-submit">
<input id="searchBtn" value="Search" type="submit" onclick="document.forms[0].submit();" ></div>

Validation error in label for HTML radio buttons

I have a validation error in my HTML form, where there are radio buttons (appleiphonebuyers.com/sell.html). Error reads:
Line 155, Column 44: The for attribute of the label element must refer to a form control.
… <label for="condition" class="inline"><span class="formstar">*</span> Conditi…
Is there another way I should apply a label to the group of radio buttons besides using "label for"?
UPDATE:
Here is the HTML for those radio buttons:
<LABEL class="inline" for="condition"><SPAN class="formstar">*</SPAN> Condition</LABEL> <INPUT class="conditionselect" type="radio" name="condition" value="Good" />Good <INPUT class="conditionselect" type="radio" name="condition" value="Okay" />Okay <INPUT class="conditionselect" type="radio" name="condition" value="Bad" />Bad <BR />
It just occurred to me that maybe I have to change the INPUT class to "condition" so it's the same as the "label for" attribute? I thought it was the name that had to be the same but maybe it's the class? –
Is there another way I should apply a label to the group of radio buttons besides using "label for"?
A <label> labels a single form control, not a group of them.
Use <fieldset> and <legend> for a group of font controls.
<fieldset>
<legend> Condition </legend>
<input type="radio" name="condition" id="condition_1" value="1">
<label for="condition_1"> 1 </label>
<input type="radio" name="condition" id="condition_2" value="12>
<label for="condition_2"> 2 </label>
<input type="radio" name="condition" id="condition_3" value="13>
<label for="condition_3"> 3 </label>
</fieldset>
Maybe you have a typo on it, the FOR attribute should always be exactly the same as in the ID.
Other than that I don't see nothing wrong. You'd have to feed us some more HTML to be able to help more thoroughly.
The for atribute must map to the input element's ID, and not its name.

Resources