KRL - How do you get the value of the observed field?

I am viewing a field on a modified page.

watch("#searchbox","change");

How do you get a new field value in a rule that fires after changing it?

I have a rule like this

rule get_update is active {
 select when web change "#searchbox"
  ....
}

I can’t find out how to get the new value. I cannot use view with submit.

thank

+3
source share
1 answer

I'm going to guess what I think you are trying to do:

You have an input on the page, and when the user enters input, you want him to raise the event and get a new value from the input entered by the user, so that you can react to what they have ever typed.

Based on the assumptions I made:

- , , , , . JavaScript

  • -

, http://kynetxappaday.wordpress.com/2010/12/16/day-8-raise-web-events-from-javascript/, - JavaScript

ruleset a60x488 {
  meta {
    name "raising-custom-web-events"
    description <<
      raising-custom-web-events
    >>
    author "Mike Grace"
    logging on
  }

  rule run_on_a_pageview {
    select when pageview ".*"
    {
      notify("Hello","I ran on a pageview") with sticky = true;
      emit <|
        app = KOBJ.get_application("a60x488");
        app.raise_event("custom_event_just_for_me", {"answer":42});
      |>;
    }
  }

  rule respond_to_custom_event_raised_from_emitted_js {
    select when web custom_event_just_for_me
    pre {
      answer = event:param("answer");
    }
    {
      notify("What is the answer?",answer) with sticky = true;
    }
  }
}
+3

Source: https://habr.com/ru/post/1783774/


All Articles