Confluence confiform custom javascript

Yogesh Prabhudeva
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 23, 2024

Hello , 
I have requirement where i have update json static file values from form values entered by user once the form is submitted . 

tried below script but i suspect its not reading json file to update 

 

<script>
function showMessage(myform){

 
 
// Read the JSON file 
const fs = require('fs');
let jsonData = JSON.parse(fs.readFileSync("test.json"));
 
// Add or edit data 
jsonData.Test1.type = AJS.$(myform).find('#i_mydropdown').val(); 
 
// Write the JSON file 
fs.writeFileSync("test.json", JSON.stringify(jsonData))
 
}
</script>

1 answer

0 votes
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 23, 2024

Hi @Yogesh Prabhudeva 

Are you trying to update a file in your local computer by executing a JavaScript in a browser?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events