Change Listeners

  1. #1

    Change Listeners

    Hi!

    I have two textfields with change-listeners. Why these triggers work at the same time?

    X.Container()
        .Items(
    		X.Container()
    			.Items(
    					X.NumberField()
    						.MinValue(0)
    						.FieldLabel("field_1")
    						.LabelWidth(110)
    						.Name("f1Name")
    						.Flex(1)
    						.Listeners(ls =>
    							{
    								ls.Change.Handler = "console.log('f1')";
    							})
    			),
    		X.Container()
    			.Items(	
    				X.TextField()
    					.FieldLabel("field_2")
    					.LabelWidth(110)
    					.Name("f2Name")
    					.Flex(1)
    					.Listeners(ls =>
    						{
    							ls.Change.Handler = "console.log('f2')";
    						})
    				)
    		)
    When i change field f2Name i see in console both "f1" and "f2"
    Last edited by Bogdan; Jan 30, 2019 at 12:13 PM.
  2. #2
    Hello @Bogdan!

    I cannot reproduce this. I only get f1 logged when I modify the value in the number field, and only get f2 logged when I type (or erase) something in the text field.

    There is probably something else in your actual code that is necessary to reproduce the issue. Please try to make yourself a simple page with the code you provided, and do not include the layout, but also add the X.ResourceManager() to the Razor markup in the own page; this way you'll be able to simplify the test case and perhaps identify what's the scenario that causes this; then we could help you with getting around the issue.

    Hope this helps!
    Last edited by geoffrey.mcgill; Jan 31, 2019 at 3:12 PM.
  3. #3
    Thank you for reply.
    You are right, simple example works fine.
    The reason of so wrong behavior was duplication of forms.

Similar Threads

  1. [CLOSED] Panel listeners
    By vadym.f in forum 3.x Premium Help
    Replies: 2
    Last Post: Aug 13, 2015, 3:46 PM
  2. Replies: 1
    Last Post: Jan 16, 2015, 4:17 PM
  3. Listeners with razer
    By zhdl in forum 2.x Help
    Replies: 2
    Last Post: Jul 18, 2012, 12:53 AM
  4. Listeners with MVC3
    By zhdl in forum 2.x Help
    Replies: 0
    Last Post: Jul 09, 2012, 1:43 AM
  5. Listeners to dblClick
    By simbal in forum 1.x Help
    Replies: 0
    Last Post: Apr 16, 2009, 7:09 PM

Posting Permissions