onchange

onChange and onSelect in DropDownList

三世轮回 提交于 2019-11-29 07:09:07
I have a DropDownList that asks the user if he want to join the club: Do you want to join the club Yes No Under this list there is another list that is set to disabled as a default. This list has the departments of the club. This list will not be enabled until the user chooses Yes. I built the following code but the problem that I couldn't solve is let's assume the user chooses Yes then he changes his decision so he will choose No again. In this case the list of the departments still enabled. I want it to be disabled when he chooses No again. <html> <head> <script type="text/javascript">

select and onChange in a Ruby on Rails form

折月煮酒 提交于 2019-11-29 06:52:05
I browsed all SO questions and answers about this topic but I'm still unable to make my scenario work. I want to trigger a click button action when a dropdown menu option is selected ; seems simple and should be very common with AJAX. Here are the relevant excerpts of my code: <%= form_for(@test, :html => {:id => "form_id", :name => "MyForm", :remote => "true"}) do |form| %> <%= form.label "Menu1" %> <%= form.select (:Menu1, [["Option1","value1"],["Option2","value2"]], :html_options=>{:onChange=>"javascript: this.form.apply_button_name.click();"}) %> <!-- more select menus and text fields here

Selenium onChange not working

人盡茶涼 提交于 2019-11-29 06:24:56
I have tried a number of things to try and get Selenium to pick up an 'onchange' event from a drop down menu, none of which has worked. The offending HTML is: <select onchange="doOpperation(this.options[this.selectedIndex]); this.selectedIndex = 0;" name="opps_ondemand" id="opps_ondemand"> <option value="none" id="ondemand">Mark as...</option> <option cmd="blah1" value="add">Something</option> <option cmd="blah2" value="remove">None</option> </select> I have read that Selenium IDE doesn't record some on* events, and so it would be wise to use fireEvent(): $this->click("opps_ondemand"); $this-

Can jQuery check whether input content has changed?

♀尐吖头ヾ 提交于 2019-11-28 17:21:10
问题 Is it possible to bind javascript (jQuery is best) event to "change" form input value somehow? I know about .change() method, but it does not trigger until you (the cursor) leave(s) the input field. I have also considered using .keyup() method but it reacts also on arrow keys and so on. I need just trigger an action every time the text in the input changes, even if it's only one letter change. 回答1: There is a simple solution, which is the HTML5 input event. It's supported in current versions

How to fire JQuery change event when input value changed programmatically?

ぃ、小莉子 提交于 2019-11-28 13:15:38
I want to fire the JQuery change event when the input text is changed programmatically, for example like this: $("input").change(function(){ console.log("Input text changed!"); }); $("input").val("A"); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type='text' /> But it doesn't work. How can I make this work? Pranav C Balan change event only fires when the user types into the input and then loses focus. You need to trigger the event manually using change() or trigger('change') $("input").change(function() { console.log("Input text changed!"); })

jQuery change event being called twice

坚强是说给别人听的谎言 提交于 2019-11-28 09:37:10
I have a form with some input and select boxes, each has class="myClass" . I also have the following script: $(document).ready(function() { $(".myClass").change(function() { alert('bla'); }) }); I dont understand why after each change in select box or input box, this function is being called twice. What's wrong here? Appreciate your help! All I can think of is that you used the same class on the form itself. if so, remove the myClass style from your form tag. Corrected : http://jsfiddle.net/rY6Gq/1/ Faulty one with double alert: http://jsfiddle.net/rY6Gq/ e.stopImmediatePropagation(); is what

Detecting change in the value of python variables

↘锁芯ラ 提交于 2019-11-28 06:01:33
问题 Is there some way to call a function each-time the value of a variable changes, in python? Something like a listener, perhaps? Specifically, I'm referring to the case where only the variable is shared between scripts like a GAE-Session. (Which uses Cookies, Memcache, etc to share data) Example: ScriptA & ScriptB, share a session variable. When Script B changes it, SctiptA has to call a method to handle that change. 回答1: Use properties. Only mutable values can change to begin with. class

React Checkbox not sending onChange

会有一股神秘感。 提交于 2019-11-28 05:35:45
TLDR: Use defaultChecked instead of checked, working jsbin . Trying to setup a simple checkbox that will cross out its label text when it is checked. For some reason handleChange is not getting fired when I use the component. Can anyone explain what I'm doing wrong? var CrossoutCheckbox = React.createClass({ getInitialState: function () { return { complete: (!!this.props.complete) || false }; }, handleChange: function(){ console.log('handleChange', this.refs.complete.checked); // Never gets logged this.setState({ complete: this.refs.complete.checked }); }, render: function(){ var labelStyle={

onChange event for HTML5 range

有些话、适合烂在心里 提交于 2019-11-28 05:10:41
Currently the onChange event on my range inputs is firing at each step. Is there a way to stop this event from firing until the user has let go of the slider? I'm using the range to create a search query. I want to be able to run the search every time the form is changed but issuing a search request at each step of the slider's movement is too much. Here's the code as it stands: HTML: <div id="page"> <p>Currently viewing page <span>1</span>.</p> <input class="slider" type="range" min="1" max="100" step="1" value="1" name="page" /> </div> JavaScript: $(".slider").change(function() { $("#query")

How can I distinguish whether Switch,Checkbox Value is changed by user or programmatically (including by retention)?

雨燕双飞 提交于 2019-11-28 03:44:10
setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // How to check whether the checkbox/switch has been checked // by user or it has been checked programatically ? if (isNotSetByUser()) return; handleSetbyUser(); } }); How to implement method isNotSetByUser() ? anthropomo Answer 2: A very simple answer: Use on OnClickListener instead of OnCheckedChangeListener someCheckBox.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { // you might keep a reference to the CheckBox