Input Event in End User App

Hi Everyone

Hope you are doing well. Righ now im building an end user app to get a data when a user fill an input. Right now Im facing the issue that my app doesnt obtain the value when I fill the input. Here is my code from app.js:

document.onreadystatechange = function () {

  if (document.readyState === 'interactive') renderApp();

  async function renderApp() {

    try {

      window.client = await app.initialized();

      client.events.on('app.activated', onAppActivate);

    } catch (err) {

      handleErr(err);

    }

  }

};

$(document).ready( function() {

  app.initialized()

      .then(function(_client) {

        console.log("Primea funciona app inicializada");

        var client = _client;

        client.events.on('app.activated',

          function() {

                                  

                      client.request.invoke("serverMethod", {}).then(function(data) {

                          console.log(data.body);

                          console.log(data);

                          objToken = JSON.parse(data.response);

                          console.log(objToken.access_token, "TOKEN");

                       

                      });

                                  

      });

  });

});

async function onAppActivate() {

  try {

    let { portal } = await client.data.get('portal');

    let textElement = document.getElementById('apptext');

    textElement.innerHTML = `Portal name: ${portal.name}`;

    console.log("TEST APP ACTIVADA");

          

  } catch (err) {

    handleErr(err);

  }

}

function handleErr(err) {

  console.error(`Error occured. Details:`, err);

 

}

$(document).ready ( function() {

  app.initialized().then(function(client) {

  window.client = client;

  client.events.on("customFieldChanged", eventCallBack);    

});

});

var eventCallBack = function (event) {

  var customField = event.data;

  var test = customField.hola;

  console.log(test);

 

}

Here is the capture of my input fields: 
![image|690x330](upload://nyIX1pORoa0JRopNEvy0NsWsIsZ.png)


Thank you for your help

Hello Andrea

Can I understand why you have both document.onreadystatechange and $(document).ready. Can you probably remove the jquery one and try to run it again?

1 Like

Hi Shravan.

Hope you are doing well. Can I asking you something ? It is possible get the information of a input from customer portal ?

Regards

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.