Brian, I get the following error when I run it:

ev_body_load failed: ReferenceError: init is not defined, which is
required since the javascript calls it here:

function ev_body_load(){init();} // must use JHS framework load handler

In jijx, I see this:

|value error: initTurtles
|       initTurtles 1


In the code you pasted, I don't see initTurtles defined either

Lastly, your post is failing because ev_command_enter needs to return
a jhr response...

ev_command_enter=: 3 : 0
T=:T+1
s=: getv 'command'
". s

NB. NEED TO ADD SOMETHING LIKE BELOW
create ''
)

For example, you can call create'' again and pass whatever you want to it

Bob does this as well in vlitejwiki

ev_sentence_enter=: 3 : 0
try.
s=: getv'sentence'
catch.
create s; BODY rplc_jhs_ 'RESULT';'<div >  </div>'
end.

Hope that helps


On Mon, Mar 3, 2014 at 7:27 PM, Brian Schott <schott.br...@gmail.com> wrote:
> Eric,
>
> It appears my ev_command_enter is NOT being triggered by pressing the Enter
> key while in the text field. I have even placed a debugging counter, T, in
> ev_command_enter, but it is not being incremented.
>
> Could you or others look at the excerpt of code below, please? I have
> patterned it after both Eric's demogl1.ijs and Bob's vlitejwiki.ijs, but
> cannot seem to get over this bump in the road.
>
>
> coclass'tgsj'
> coinsert'jhs'
>
> HBS=: 0 : 0
> '<h2>Type in a turtle command</h2>'
> 'command' jhtext 'fd 10';50
> '<canvas width="600" height="600" id="glcanvas"></canvas>'
> )
>
> jev_get=: create
>
> create=: 3 : 0
> 'tgsj'jhr''
> T=: 20
> initTurtles 1
> )
>
> ev_command_enter=: 3 : 0
> T=:T+1
> s=: getv 'command'
> ". s
> )
>
> JS=: 0 : 0 NB. javascript
> function ev_body_load(){init();} // must use JHS framework load handler
> function ev_command_enter(){jsubmit();}
> )
>
> Thanks,
>
> On Mon, Mar 3, 2014 at 11:13 AM, Eric Iverson <eric.b.iver...@gmail.com>wrote:
>
>> Shooting from hip response without a careful reading of your message.
>>
>> jev_get is for the http get request. It is the verb that is run when
>> you first browse to that page. It is not a response to an ajax
>> request.
>>
>> What is the J definition for ve_command_enter? When jev_get is called
>> it will get the error you indicate if the J verb ev_command_enter is
>> not defined.
>>
>> Note that in general there are both javascript and J definitions with
>> the same names.
>>
>> Look more carefully at the patterns in working J examples. It is
>> likley that jev_get should be defined to be create.
>>
>> On Mon, Mar 3, 2014 at 11:07 AM, Brian Schott <schott.br...@gmail.com>
>> wrote:
>> > I have problem code inside a JHS app I am trying to write. The app will
>> > accept user inputs of valid commands like `fd 10` and produce canvas draw
>> > updates.
>> >
>> > This line in jijx is producing the error below it.
>> >
>> >    load'~Projects/tgsjhs/tgsjhs.ijs'
>> > |syntax error
>> > |       jev_get_tgsj_''
>> > *** response not sent for tgsj
>> > *** html409 Conflict
>> >
>> >
>> > *********code is below*********
>> > HBS=: 0 : 0
>> > '<h2>Type in a turtle command</h2>'
>> > 'command' jhtext 'fd 10';50
>> > '<canvas width="600" height="600" id="glcanvas"></canvas>'
>> > )
>> >
>> > create=: 3 : 0
>> > 'tgsj'jhr''
>> > )
>> >
>> > jev_get=: ev_command_enter
>> >
>> > CSS=: 0 : 0
>> > body{margin:10px;}
>> > )
>> >
>> > JS=: 0 : 0 NB. javascript
>> > function ev_body_load(){init();} // must use JHS framework load handler
>> > // function ev_command_enter(){jdoajax(["command"],"");}
>> > // function ajax(ts) {jbyid("command").value=ts[0];}
>> > )
>> >
>> > *********code is above*********
>>
>
>
> --
> (B=)
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to