VISUALNEO WEB + JAVASCRIPT - Forum

Forum Navigation
You need to log in to create posts and topics.

VISUALNEO WEB + JAVASCRIPT

Hi

I completed learning with the tutorial " How to code a Database part 1-7" and

designed application without any problem .

Now I am trying to learn how to execute javasripts , with no Sucess !
the decisive factor for me to Purchase visualneoweb as app developing tool.

is there any java visual neoweb interaction tutorial with examples as the database tutorial ?
it seems easy , but for a new beginner Tutorial is the best !

I found the the simplest script on the forum . like the one below .
Pasted the code on a button , dont work .
paste in the sub routine , dont work either .
tried to call the subroutine , dont work either !

In the example one variable from Neoscript passed to the javascript for
computing . and capturing the result . ( which did not work for me )

how would it be if i want to pass an array to the java script function ?

SetVar "[diffNeo1]" "111"


BeginJS
var diffJS1 = $App. diffNeo1 ; //neo to js
var diffJS2 = diffJS1 * 3 ; //compute


$App. diffNeo2 = diffJS2; //js to neo
EndJS


... validate
AlertBox "diffNeo2" "[diffNeo2]" ""

Thanks !

The code which i got from this forum  dont work .  And   I  wrote my own  code by learning  which was great !...   here Is the code and it will be  valuable for new Beginners .

the code works but , have problems to get variable values from Visualneoweb .

BeginJS

/////.....age= neosubroutine.tag();


message = 'Hello'; // store the string 'Hello' in the variable named message   (javascript
$App.message=message;  // assign neoscript variable

user = 'John';
$App.user=user;

age = 25;
$App.age=age;


multiply = age * 3;       execute   math   with javascript
$App.multiply= multiply;         get  the result with  Neoscript

EndJS


... validate
AlertBox "Result" "[message]    [user]    your  age is    [age] .   and let me see you at  [multiply]" ""

for ex i tried to get   the  age value  with      age= neosubroutine.tag();  the value is captured   by the function but nothing happens ......

is there any expert out here who wants to  help .......    it is killing my time although it is easy  .......

@caro I need to understand your problem first.
Note that all NeoScript code is translated to JavaScript and you can see the final JavaScript by right clicking into teh neoScript code editor and clicking on "Preview JavaScript". What I mean is that JavaScript is the natural VisualNEO Web language and it works perfectly.

The problem with your original code is that AlertBox expects a text string as an argument and not a number.

Try this instead:

SetVar "[diffNeo1]" "111"
BeginJS
var diffJS1 = $App. diffNeo1 ; //neo to js
var diffJS2 = diffJS1 * 3 ; //compute
$App. diffNeo2 = diffJS2; //js to neo
EndJS
... validate
AlertBox "diffNeo2" "[diffNeo2] " ""

Note the additional space after [diffNeo2] on the last line. Including a space converts the argument into a string text.

Second one:

BeginJS
/////.....age= neosubroutine.tag();
message = 'Hello'; // store the string 'Hello' in the variable named message   (javascript
$App.message=message;  // assign neoscript variable
user = 'John';
$App.user=user;
age = 25;
$App.age=age;
multiply = age * 3;
$App.multiply= multiply;   
EndJS
... validate
AlertBox "Result" "[message]    [user]    your  age is [age]. And let me see you at  [multiply]" ""

Everything works correctly.
Please remember to use the web browser Console for checking possible errors.

Regards.