Closed Evgeny243 closed 1 year ago
@Evgeny243 Try console.error() or warn()
instead of console.log()
.
Show me your form elements, what is the id for the 'Copy' element. Id and Label are different.
I can see the console now. Much easier to troubleshoot. The function also works now. How should I change the code above to replace the value of "Copy" by the value of "PD"?
@Evgeny243 Like that:
const PD = elements.find((element) => element.id === "PD");
console.warn(PD.value);
@mikhail-vl A followup question: When I try to write something to database using fetch I see an error: Blocked loading mixed active content “http://influxdb.......&precision=ms”
When I change that to https:// then I get an error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://influxdb........&precision=ms. (Reason: CORS request did not succeed). Status code: (null).
Is that something that has a known remedy?
Hi @mikhail-vl . I have essentially no experience in JavaScript, so i would really appreciate if you can help me with the following simple task: I use Query in Initial Request. The data is loaded from InfluxDB into element "PD". Then I try in the Custom Code of the Initial Request to write a "new_value" string into the value of another element "Copy" using following code:
onChange(elements.map((element) => { return element.id === 'Copy' ? { ...element, value: 'new_value' } : element }); console.log(data, response, initial, elements); return;
Nothing happens. Also the console.log is not producing anything on the screen, so I am not sure how that function works. I attached a snapshot. Once this works the next step is to write the value of the "PD" element into the value of the "Copy" element.
Thanks!