Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Interact javascript with form fields

Marcos Calleja
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!
February 5, 2018

Hi,

I have a confiforms form with several fields and I need to use javascript to get the value of the fields, do something with its value, split for example, and set the new value to another field.

At this point I can get the value as follows:

<script>
var str = '[entry.myfield]';
var arr = str.split(" "); 
var text = "";
var i;
for (i = 0; i < arr.length; i++) {
    text += arr[i] + ","
}

// this line is just what I need, but doesn't work
'[entry.otherField]' = text;
</script>

 

I've also tried something like this:

AJS.toInit(function(){
var str = '[entry.anyField]';
var arr = str.split(" ");
var text = "";
var i;

for (i = 0; i < arr.length; i++) {
text += arr[i] + ","
}

// This doesn't work too
AJS.$('#i_otherField').val(text);
});

 

Thanks in advance

 

3 answers

0 votes
aijaz-ipa
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 29, 2019

Looking for an answer too.

0 votes
Paul Ward October 1, 2018

 don't have an answer, but need to do the same thing!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events