Forums

JS change Value - After submit

garagecreations 23 Sep, 2015
Hello,

I am using an API and I get the response from them. I have one value "status" that I read and I can print with JS. I would like to save that in the DB.

I added a hidden field to the form and tried to change it before saving the array in the DB.

I tried:
1- document.getElementById('status').setAttribute('value',status);

2-$('.hidden').val(status);

3- $('#status').val(status);

none of them worked. Is there any way I can do that with Chronoforms? When I try to debug in the browser it says that cannot set the value of null or that is an invalid expression.
GreyHead 23 Sep, 2015
Hi garagecreations,

What kind of API is this and how do you receive the status?

If it's an Ajax query done in the browser then something like your first line should work OK assuming that the hidden input has the id set to status and the value you receive is in a JavaScript variable names status.

Bob
This topic is locked and no more replies can be posted.