issue with jquery validation error messages - javascript

I have 3 radio groups each having 'yes' and 'no' value. Beside each of those radio groups there are 2 dropdown menus 'colour' and 'shade'.
PROBLEM:
When I select yes or no for radio button and nothing for the two drop downs and click submit i get an error 'Please select colour and shade for (USER)'. This is how I want it but when i click ok on this error I get please select attendance for USER2 immediately after. How do i remove this as I only want the first error displayed.

You appear to have 2 blocks running on input:submit.click(). So each time the button is pressed, it is running each block.

Related

Uncheck radio button datatable with pagination

I have a datatable with radio buttons for every row, my problem is that when i check the radio button in first page for example and go to another page and check another radio button i sow that the first one (in page one) still checked.
Expected : When i select a row, then i change the page in the table, and if i re-select a row, the value of the previous page must be deselected.
I'm using this https://datatables.net/examples/data_sources/js_array
thinks

Finding out wether a Radio Button was Selected in a Radio Button-Group

i work with SapUi5 and i want to know a faster way to check wether/how many buttons where clicked in a Radio Button Group.
Situation: In the Section there are 3 - RadioGroups with 4 Options pro Group, i.e. 12 in Total, i have given each Group an ID.
Now in a specific File: the Operation sap.ui.getCore("idOfRadioButtonGroup").getSelected() - does Work and gives out wether a Button was clicked, however in the File that i operate from this Operation seems to now work.
There is another possiblity to check wether a button was clicked in one of this 3 Groups:
sap.ui.getCore().byId("idFirstRadioGroup").mAggregations.buttons[0-3].mProperties.selected
//(4 Buttons pro Group)
However i would like to know a different solution
Expected Results: A possibility to find out if a button from a Radio Group
was clicked. (1 Button/4 can be clicked pro RadioGroup)
Actual Results: Doesn't seem to work to full extend
I guess you are looking for the function "getSelectedButton".
Returns the selected radio button.

Can't click or select an item from javascript dropdown menu using VBA

As the title suggests, I've found the ClassName of the button I want to click (I think, because the innertext on that ClassName array # gives me the correct text shown on button). Problem is, I'm clicking it but it does nothing.
This is my best attempt, among dozens, but it's not doing anything.
For Each i In IE.document.getElementById("typeSelector")
If i.innerText = "Revenue" Then
i.Click
i.FireEvent ("onchange")
'This click and fireEvent are activated but do nothing.
End If
Next i
'These next ones are Hail Mary's stacked on top of each other to see if I get a reaction out of that damn box. Nada.
Debug.Print IE.document.getElementsByClassName("chzn-single chzn-default")(0).innerText 'Prints "Select an option". I thought clicking this would at least open the drop down menu but still, nothing.
Debug.Print IE.document.getElementById("typeSelector_chzn_o_14").innerText 'Prints "Revenue". This is the option within the dropdown menu, shown after clicking the menu when manually done.
IE.document.getElementsByClassName("chzn-single chzn-default")(0).Click
IE.document.getElementById("typeSelector_chzn_o_14").Click
To summarize, I've tried activating the option based on index, clicking the box, clicking the box then clicking the "Revenue" option. The website remains completely unmoved. Should be noted that a succesful click would not update the website, simply highlight the "Revenue" option in the menu, and open up a Date input box.

Objects that are "unhidden" after checking a box don't go away when a different box is checked

So here's the code I'm using to make it so any checkbox of a certain class can only have one option selected among the others with the same class.
$(function() {
$(".single-checkbox1").on("click", function() {
$(".single-checkbox1").not(this).prop("checked", false);
});
});
Except, some of these checkboxes show objects when checked, like a text box or text area. The issue is that, unless you manually uncheck the box that shows the object before checking a different box, the object doesn't go away.
For example, if I checked box 1 to reveal textbox 1, then checked box 2 (the page then unchecks box 1 as only one box is allowed to be checked,) the textbox 1 will not disappear.
However, if I manually uncheck box 1 before checking box 2, textbox 1 WILL disappear. Has anyone encountered this error before?
Why don't you use radio buttons instead? Radio buttons in a group only allow one button to be checked at a time. You can do a change event or .each on the group and based on the checked property, you can hide or show the appropriate check boxes.
How do you show/hide the objects when a checkbox is (un)checked? Is it in another on click handler?
If so, I think $(".single-checkbox1").prop("checked", false) only unchecks the checkbox but doesn't call its handler (so the object will not show/hide). It may be better to do something like:
$(".single-checkbox1").on("click", function() {
$(".single-checkbox1:checked").not(this).click();
// If it's a different handler, do
// $(".single-checkbox1:checked").not(this).trigger('whateverHandler');
// If this doesn't uncheck the box then do this instead
// $(".single-checkbox1:checked").not(this).prop("checked", false).click();
});
Create a plunker or snippet if none of this helps and we can try other solutions.

Confimration not appearing when it should do

A confirmation is not bing displaye after all validation has passed, instead it is showing a validation message stating no students have been selected to add even though I have done this. How can I get the confirmation to be displayed?
Here is an application you can use to see and use for yourself:APPLICATION
Select a course from drop down menu
In Avialable Students to Enrol box you will see list of students. Select a student and click on the Add button underneath and you will see that student added into the box underneath.
Click on the Submit Students button at the bottom and it displays the validation message saying you have no selected a student to add to course, but you have done this so the confirmation should appear. This is the problem
The jsfiddle showing the whole code for this is here:
http://jsfiddle.net/PhWbm/3/
You are checking for children of an element with the ID courseadd while the ID you should be looking at is studentadd. Try changing either the ID of the select or the selector.

Categories