Web 2.0 API is there a chance to react on Javascript Events

I want to write an App where I need javascript events. Is there a possible way to react on this Browser events with xojo and get Data from the Browser to xojo properties? Thanks for answering.

the answer is here:

Ask @Greg_O_Lone if there will be documentation for the WebSDK coming ?

Look here:


In the examples

The trigger event is not implemented yet as far as I found out

I’m using it in in my projects and it works good:

XojoWeb.session.comm.triggerServerEvent('ControlID','METHODNAME',<<JSONITEM>>)"

4 Likes

With 2020r1?

Yes sir

Maybe I’m wrong, but I did some tests passing a fairly large JSON object containing a BASE64 string and I don’t understand why XojoWeb.session.comm.triggerServerEvent 9 times out of 10 does not return the right object to Xojo. Is it possible that if the JSON content is too big something breaks?

I created a small example, if you remove the base64 code everything works correctly…

Make sure you set the second parameter for EncodeBase64(mystring, 0) to 0 to have no line breaks

Thanks for the suggestion but I don’t think that’s the problem. I am trying to return a base64 string from javascript to xojo. If I take another file, for example an image, and do the same thing it works…

Base encoded javascript images probably use “data:image/png” or something from the start of the image data you remove that or ?

Yes of course, they are valid characters for a string, so they do not give problems (it’s up to me to decide what to do with them). Look at the example so we understand each other…

1 Like

The problem is your JSON is invalid. You might want to brush up on JavaScript and Xojo prior to building WebSDK controls.

The offending line:
source.Append("result: base64,")

1 Like

I did not understand… what would be the mistake? I have been using xojo for 5 years and have implemented several controls with the 1.0 framework

Update: I do see the base64 object now.

Ok no problem. Thanks anyway for your efforts.

It could be a length issue, but I don’t know. It’s happening somewhere inside the framework, the json object is in scope and correct when triggerServerEvent is called.

Screen Shot 2020-12-05 at 10.33.35

Might need to file a ticket for this one too.

Ok done. You can find it here.