re-open
Public

I have read the posts & documentation on Javascript snippets, and I understand that it is not really a supported feature, but is there a way I can integrate javascript with foreUI elements?   I need to do something like:

Set “TextBox_1″ value to myJavascriptFunction( <a_ForeUI_Userdefined_Property> )

Thanks!

Roy

16 answers

Staff July 29, 2015

Hi Roy,

It is possible to do it by calling some ForeUI predefined functions in the “Call Javascript Snippet” action. Let’s say you defined a function named “myfunc” in the “Script” element:

Then in the “Call Javascript Snippet” action, you can put the content below: 

Then you will see it updates the text of TextBox_1, to doubled value of property “tmp” (please notice the property expression is {“tmp”} in EVAL mode, needs quote marks for property name).

 ===================================================================

I really want to use a nicer way to do it, like this:

It really should work, but unfortunately it doesn’t, because of a bug: diagnose engine doesn’t see the myfunc function in Script element, and will regard it as an error. As a result, this action will not get exported to the HTML5 simulation.

We will try to fix that bug in next version, then you will be able to use that nicer approach :-)

 

#1
  1. Hi ViVi, is this "nicer way to do it" implemented in version 4.20? I'm trying to call a JavaScript element to generate the content of a TextBox element from the "Manipulate Elements" dialog, but it's not working for me. I can't tell whether I have an error in my syntax in Step 3, or if the problem is that this approach still won't work from "Manipulate Elements" in version 4.20. (BTW, I'm on the third day of my evaluation of this product and I love it! Thanks for all the hard work!)
  2. ViVi Staff May 31, 2016
    We have something better now, although it is not a final solution yet. Please see my new answer below.
Staff May 31, 2016

There is a nicer way that can work, but still it is a workaround.

There are two key points:

  1. You can turn off the diagnose for certain line of behavior, so it will not disable that line by mistake.
  2. You can define the Javascript function in the “Call Javascript” action.

Below is an example that I tried and confirmed it is working.

#2

Well this is great site! Would definitely recommend this to my friends. Love the read  countertops spokane wa

#3

Great site thanks admin. More power. https://breastaugmentationfresnoca.com

#4

The information you have posted is very useful. The sites you have referred was good. Thanks for sharing.  dentalimplantsmemphistn.com

#5

love how detailed this article is, great job! mold remediation atlanta

#6

wow never knew about this before, thanks for sharing! newborn photography seattle

#7

I really loved it here but are there any recent updates? Thanks  roanoke fence

#8

Well this is great site! Would definitely recommend this to my friends. Love the read  bigger boobs

#9

The information you have posted is very useful. The sites you have referred was good. Thanks for sharing  http://www.dentalimplantsshreveportla.com

#10

I was wondering if it is possible to show a drag and drop for row in table to a element in a tree.

concrete driveway

#11

I want to express my gratitude for this wonderful article. fnaf security breach

#12

thanks for this great share, fill your free time with drift hunters game to no longer be bored, will help you to be more active

#13

I want to thank you for writing this great article. flagle

#14

There are a few ways to use custom JavaScript to populate element properties. One way is to use the setAttribute() method. This method can be used to set any attribute of an element, including custom attributes. Another way is to use a property assignment. This can be used to set any property of an element, including custom properties. Finally, you can use a data-* attribute. This can be used to set any data-* attribute of an element. I have resolved this error from the logistics dissertation topics website through the defined way. I hope this will also help you out. 

#15

I think I’d without a doubt suggest this unblocked gamez to my friends

#16

Please login or Register to Submit Answer