I came across a problem with checking and unchecking the same record on form.
I have a form with list of records, depending on status on record you can see an active/inactive button. Logic for this is included in active method on data source. When i click checkbox first time for some record it is Ok, button acts as required, but when i click this same checkbox second time to uncheck this record, the button does not work ok. For example if a record is checked the button Accept is active, but if a record is unchecked the button Accept should be inactive. I tried to solve this issue also with selectionChanged method but it didn't help. Could you give me some guidance how to handle with this problem?
Below I updated my post with pictures - it is specifically about Confirm button.
Thanks for add you code.
Ok, this is the button ComplaintConfirm?? if this is the botton in one part you compare Complaints.ComplaintConfirmed == Complaints_ComplaintConfirmed.checked(false)
Complaints.ComplaintConfirmed if a enum NoYesId?? if a NoYesId perhaps here is the error.
Can you try this?
ComplaintConfirm.enabled((Complaints.ComplStatus == ComplStatus::Accepted || Complaints.ComplStatus == ComplStatus::Rejected) && Complaints.ComplaintConfirmed == NoYes::No);
Related
Sorry if this is a dumb question. I'm a GTM noob and from googling I see tutorials on tracking the clicks (checkbox element and Checkout button) separately but was wondering if there's any way this can be one Event in Google Analytics.
For example, on our store's cart page a checkbox to add a product's accessory is selected by default. I want to know how many people are hitting the Checkout button and leaving this "add an accessory" checkbox checked.
Is there a way to push an Event as something like "Checkout click - Add On Checkbox - Selected"?
Thanks in advance!
Yes, you can detect if a checkbox is checked on any event, using a Custom Javascript variable, value of which you then can use in the trigger, or in your tag. Or in a different variable, of course.
If you provide the html of your checkbox, we can give you code for the variable to return the checkbox state if you're not comfortable with JS.
//Upd
In your code, you have a few errors. First, no need to name the function in the CJS variable. Also, you write a bit too much code and rely on JQuery with no need. It can be solved simpler with pure JS like so:
function(){
return document.querySelector("input#add-subscription").checked;
}
Now, about the rest of what you're saying. Having this checkbox action. You have a wrong understanding. This is not a checkbox action. This code only gets the state of the checkbox whenever the value of this variable is being used.
So if you're gonna use the value of this variable when a person clicks on the form submission CTA, then this code will run on that click, assessing the value of the checkbox.
Your amazon example works. But you don't need to assume that the checkbox is checked by default. The default doesn't mean anything here. The state of the checkbox is assessed on the trigger where the value of the CJS var is used, that's it.
We're proceeding with your question: I'm confused about having the multiple criteria (checkbox is checked and user hits Checkout button) and if including both as triggers would work You're making another mistake here. They're not both triggers. One of them is a trigger indeed, which is a click trigger. The other, however, is a condition for the trigger to fire. You know how in the trigger, you click the checkbox that says "some events"? This fella:
Once you have that, you can add conditions. Like, only use this trigger when... when what? Anything really. In our case it would be when the checkbox is true.
Finally, for the checkout click, you don't typically need more than just the click trigger with the CSS selector criteria.
Anyhow, to be short, this is about how your trigger should look like:
Thanks! In this case the checkbox element for my cart page is:
<input id="add-subscription" type="checkbox" checked="checked" class="form-checkbox js-product-subscribe-newux mt-10 sm:mt-0" name="sub" value="remove">
I was thinking the variable could be:
function checked() {
var check = jQuery('form-checkbox js-product-subscribe-newux mt-10 sm:mt-0').attr("checked");
if(check === "checked") {
return true;
} else {
return false;
}
}
However where I get confused is having this checkbox action (checkbox is checked) only count as an event when the user hits the Checkout button. Using this Amazon cart page as an example, assuming the "This is a gift" checkbox is clicked by default, "This is a gift" checkbox would I just then add the Trigger as having two criteria, roughly: {{Checkbox Variable}} = "true" & Click Text = "Proceed to Checkout? I'm confused about having the multiple criteria (checkbox is checked and user hits Checkout button) and if including both as triggers would work in this case so I can see how many times users click to checkout from the cart while leaving that box checked. Or would the Click on the Checkout button need to be it's own separate variable rather than just specifying the Checkout button name in the trigger criteria?
Update:
After further investigation, actually what's happening is when the checkbox is checked using jquery, the next step is to click the button to save. Well, for some unknown reason, the checkbox is unchecking itself.
Here's the jquery to select the checkbox:
string jsStmt = #"
$(function(){
$(':checkbox').filter(function(){
return $(this).parent().next('td').text() === 'Label to look for';
}).prop('checked', true);
});
";
IJavaScriptExecutor js = (IJavaScriptExecutor)_driver;
js.ExecuteScript(jsStmt);
I can see the checkbox get checked, then when the dialog closes I can see it get unchecked?
OP:
Button click event for Selenium testing has been working for a while. All of a sudden, it's not working anymore. Only possible change was some 3rd party css change but I don't know what it could've been.
The button is kind of buried in layers, however, there's a checkbox that gets checked by Selenium that is still working fine, and it's the reason why the button needs to be clicked.
I can debug, and see that Selenium is finding the button. It appears that the button gets clicked but the postback event doesn't occur.
I can stop execution right before the click event and open developer tools and manually type in the statement to click the button, AND that works!
I even tried executing the click with JavaScriptExecutor with no luck.
I am so lost why it's Not firing postback event.
In short, try clicking the checkbox using an IWebElement instead of javascript.
I would suggest avoiding using IJavaScriptExecutor as much as possible in selenium tests as it can lead to performing functions the user wouldn't actually be able to do with simple interactions, or having those functions behave differently than you would expect because the execution path is different than what a user would do if they just clicked something.
I think that's what you're running to in this case where you're trying to mark the box as checked.
I'm new to Zoho CRM. I need to show a warning on button press but only once for the first button press. This sounds really simple but yet I can't figure out how to do it in Zoho Creator as all variables seems to have local scope so I can't determine if the button was pressed before. I've been searching if there are global variables in Zoho but found only workarounds with creating another applications for that case.
I've also tried creating a field on my form and hiding it to pass some value there if the button was pressed so next time I can check this field but is not working for some reason.
In validation part I'm assigning new value to a field
warning_shown=true;
But on a form this checkbox remains unchecked and next time I press the button warning_shown equals false.
Any suggestions will be appreciated!
In case someone interested, here is a reply I got on another forum that might help. Here is a link for that topic
It's not going to be possible to use the validation code section to display the message.
I was thinking you could have your hidden decision box field, and in the "On User Input" of the last field in the form you could use something like:
//remember to change field names accordingly
if !input.warning_shown
{
alert "Message here!";
input.warning_shown = true;
}
This would show the message after the last field is filled but before the button is clicked.
I am facing a problem like I have one Vaadin ComboBox with preselected value.I am changing the value from the ComboBox to another value,then ValueChangeEvent is fired.Inside the valueChange method I have written something to show a Popup Window which has Cancel and Ok button.Upon clicking on OK button of Popup Window I am going with the changed value of the ComboBox but upon clicking on Cancel button I just want to have the old value which was there before value change event fired.
Could anyone please help me out from the above issue?
Thanks in advance.
Maybe you can save whatever SelectedItem the combobox has when the event is fired, and if the user pressed cancel, you reset it to this stored item.
Before the click, how do you know what is selected in the click? Of course, you need to store the current selection somewhere. Lets call it currentSelectedValue (it could be NULL in the begining)
On click, you have a new selection, lets call it newSelectedValue
Now, if you do not want to go with this newSelectedValue, simply do this:
combo.setValue(currentSelectedValue);
I am looping through all the posted data on my website and grabbing the values, this will then be used later on. The user is going to put 2 radio buttons on the page, one with a correct answer and one with an incorrect answer. I need to know how to see if a Radio Button is checked or not based on the posted data. Is this possible?
Thanks.
If the radio button is checked, there will be an entry in the posted data, keyed with its UniqueID:
if (Request.Form[yourRadioButton.UniqueID] != null) {
// Radio button is checked, do something.
}
If you insist on reading directly from the request collection, read Request.Form["radiobuttonname"] and it will contain the value of the selected button.
However, it's much better to check the radio button control itself - why can't you do that?