Trying to call mx.data.get from log in page

0
Hi All, I am trying call a microflow from login.html page (custom) using mx.data before sign in the application.   function do_something()                 {                     var myinput = document.getElementById("myinput");  alert( 'Test:' + myinput.value);                         mx.data.create({                                                                               callback:   function(){                                                         alert( 'Test:' + myinput.value);                                                                                                                 mx.processor.xasAction({                                                                         error:  function() {                                                                                     logger.error(this.id + "error: error while executing search");                                                                                 },                                                                         actionname:     "Mymodule.myMF",                                                                         guids:          [object.getGUID()]                                                         });                                                     }                                      }); But I am getting following error-  Uncaught ReferenceError: mx is not defined     at do_something ((login):75) Can somebody please let me know what is correct way of calling mx.data functions from html.
asked
2 answers
2

I think it depends on where you put the code. The error should be gone if it's triggered after mxui.js loaded. However, i don't think you can create something on server before you can login.

answered
0

Hi Abhinay,

I am not sure what you are trying to achieve but adding javascript code to a mendix application should be done inside a custom widget. Inside the widget you can load the mx library using the define construct - you can find more details here https://docs.mendix.com/howto/custom-widget-development/create-a-basic-hello-world-custom-widget 

Without a custom widget you have to find a way to load all mendix libraries and dependencies manually, but I would not recommend going down this route.

-Andrej

PS: Do you allow anonymous users in your App?

answered