Expand my Community achievements bar.

SOLVED

Passing ctx variable value to input text field in webapp

Avatar

Level 4

Hi 
In the below image im getting value in ctx variable like cust id email mobile and response 

so i need to populate the value  in input text field of first name email mobile response 

I was tried this approach but got an error as ctx is not defined

Here im passing the ctx variable value to temp email ,mobile  and response.
var email = (ctx.vars.email).toString();
var mobile = (ctx.vars.mobile).toString();
var response = (ctx.vars.response).toString();

Here im passing email value to id of the text input field 

document.getElementById('email').value =email;
document.getElementById('ph').value = mobile;
document.getElementById('response').value = response;

Does Anyone have idea on this 

 

vani97_1-1706186261844.png

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @vani97,

If you want to carry these values from one page to another, e.g. for data capturing, etc., then you need to use document.controller to transfer the values.

So in the script on the page where these values are being entered by the user, you need to use

 

document.controller.setValue('/ctx/vars/email', email);

where email is the value entered in the form.

 

BR,

Ishan

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @vani97,

If you want to carry these values from one page to another, e.g. for data capturing, etc., then you need to use document.controller to transfer the values.

So in the script on the page where these values are being entered by the user, you need to use

 

document.controller.setValue('/ctx/vars/email', email);

where email is the value entered in the form.

 

BR,

Ishan