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
Have a look at these examples:
https://wiki.vertuna.com/display/TEST/Change+field+label+with+Field+Definition+rule+and+JavaScript
The examples based on the fact that javascript function are called with the parameters as is shown here: https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Definition+Rules
Looking for an answer too.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.