Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6590933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:21:42+00:00 2026-05-25T17:21:42+00:00

I’m retrieving a value within an emitted code block that I would like to

  • 0

I’m retrieving a value within an emitted code block that I would like to set an entity variable to. This is what I’m trying to do:

rule read_form {
    select when web submit "#loginForm"
    pre {
    }
    {
        emit <|
            function myFunction() {
                var myValue = 10;
            }
            myFunction();
        |>;
    }
    fired {
        set ent:myValue myValue;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:21:43+00:00Added an answer on May 25, 2026 at 5:21 pm

    The way you have that architected won’t work.

    Here’s why:

    The select statement and pre block are evaluated on the Kynetx server when the event request first comes in. If the select statement evaluates to true, then the rule will return the emit JavaScript in the HTTP response to the raised event that came into the Kynetx server. Before that HTTP response goes back to the browser from the Kynetx server, the fired statement in the postlude will execute if you have an event that is going to be returned in the HTTP response. This means that the select statement, pre block and postlude blocks are evaluated and executed on the Kynetx server before the javascript is returned to the browser. So I guess the short answer is that the postlude has no idea what the value of ‘myValue’ is since the scope is very different (different machines).

    Hope this helps. I probably should make a diagram explaining it a bit better but I have some critical work I need to get done tonight. Depending on your response I may come back to this question and answer it better later.

    So, how could you make this work? You could accomplish what I think I understand you are trying to do by raising another event in your emitted javascript block passing the needed value. This would mean that the value would be available in the pre block and the postlude block of the rule that receives the raised event so you could save it in an entity variable.

    You can also look at this blog post I did about raising events from JavaScript that might help shed some more light on the subject http://kynetxappaday.wordpress.com/2010/12/16/day-8-raise-web-events-from-javascript/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to create an if statement in PHP that prevents a single post
I would like to count the length of a string with PHP. The string
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.