I am just trying to copy input of one form field to another when the user checks a box. Similar to billing and shipping address forms.
The problems is that the fields’ name and id have square brackets. I’ve tried forward slashes, quotes, dots, etc. and nothing seems to work. I’m a beginner so just poking around in the dark but has to be a way to do this?
I’ve tried just removing the brackets to see if the script itself works and it does so has to be those darn brackets!
I am unable to change the id and name on the actual form unfortunately…
Thanks in advance for any help!
< script language = "javascript" type = "text/javascript" >
function FillForms(f) {
if (f.fillform.checked == true) {
f.title[ko_KO].value = f.title[en_US].value;
f.description[ko_KO].value = f.description[en_US].value;
}
if (f.fillform.checked == false) {
f.title[ko_KO].value = '';
f.description[ko_KO].value = '';
}
}
</script>
<input type="checkbox" onclick="FillForms(this.form)" name="fillform">
<div>
<label for="title">Title *</label>
</div>
<input id="title[en_US]" type="text" name="title[en_US]" value="">
<div>
<label for="description">Description *</label>
</div>
<textarea id="description[en_US]" name="description[en_US]" rows="10" class="uniform"></textarea>
<div>
<label for="title">Title *</label>
</div>
<input id="title[ko_KO]" type="text" name="title[ko_KO]" value="">
<div>
<label for="description">Description *</label>
</div>
<textarea id="description[ko_KO]" name="description[ko_KO]" rows="10" class="uniform"></textarea>