Hi there. I am trying to identify the source of a problem with some JS events attached to buttons in a profile page. This is the the fragment code produced by elgg_view_form:
<input id="bt" value="Cambie su ubicación" class="elgg-button .submit" type="button">
which is associated to this script (embedded into a AMD module):
function() {
let empName = $('#emp').val();
$('#lblEmp').html('La nueva dir es <span style="text-transform:capitalize;">' + empName + '</span>');
ajax.action('save_evupam', {
data: {
arg0: guid,
arg1: "",
arg2: "",
arg3: empName,
},
}).done(function(output, statusText, jqXHR) {
if (jqXHR.AjaxData.status == -1) {
alert("La ubicación no pudo ser actualizada");
return;
}
alert("Ubicación " + output.respuesta);
});
}
It all works well in my local elgg 2.3.7 server, as you will see here:
https://photos.google.com/photo/AF1QipNbbQRCWpt-HTEydstpLmvScEbsMV3R7jych0L3
However, when I deploy the same code in a 2.3.8 server, the Javascript never gets loaded. See:
https://photos.google.com/photo/AF1QipNVX45XMyX1JdXogDmt4ChxmVjC2uCyRXKqN6fZ
Any idea what may be wrong?
Thank you.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- jacintodavila@jacintodavila
jacintodavila - 0 likes
- jacintodavila@jacintodavila
jacintodavila - 0 likes
- iionly@iionly
iionly - 0 likes
You must log in to post replies.1 AMD(jquery)
function n()
amd_monitor.js:1:283
2 AMD(jquery.colorbox) undefined amd_monitor.js:1:283
3 AMD(js/evupam) undefined amd_monitor.js:1:283
4 AMD(languages/es)
Object { "item:site": "Sitios", login: "Iniciar sesión", loginok: "Ha iniciado sesión", loginerror: "Inicio de sesión incorrecto. Verifique sus credenciales e intente nuevamente", "login:empty": "El nombre de usuario y contraseña son requeridos", "login:baduser": "No se pudo cargar su cuenta de usuario", "auth:nopams": "Error interno. No se encuentra un método de autenticación instalado", logout: "Cerrar sesión", logoutok: "Se ha cerrado la sesión", logouterror: "No se pudo cerrar la sesión, por favor intente nuevamente", … }
amd_monitor.js:1:283
5 AMD(elgg)
Object { config: {…}, security: {…}, session: {…}, page_owner: {…}, global: Window, ACCESS_PRIVATE: 0, nullFunction: nullFunction()
, abstractMethod: abstractMethod(), extend: extend()
, isArray: isArray(), … }
amd_monitor.js:1:283
6 AMD(elgg/widgets)
Object { init: init()
, add: add(), move: move(), remove: remove(), collapseToggle: collapseToggle(), saveSettings: saveSettings(), setMinHeight: setMinHeight()
}
amd_monitor.js:1:283
7 AMD(elgg/likes) undefined amd_monitor.js:1:283
8 AMD(elgg/messageboard) undefined amd_monitor.js:1:283
9 AMD(elgg/uservalidationbyemail) undefined
Apparently, it all reduced to this missing statement in the init:
// registering js
elgg_register_js('js/evupam', elgg_register_simplecache_view('js/evupam.js'), 'head');
That's not how you would add a JS lib on Elgg 2.x anymore. See http://learn.elgg.org/en/stable/guides/javascript.html#using-traditional-js-libraries-as-modules if you can't add the code as AMD module.