01-25-2015, 07:41 PM
I gave it a try and eneded up with this code:
Drop that into the root of your coreBOS install and it should work. Note how I have to change the colon for semi-colon in the name. Very strange.
My recommendation would be to use the field name: webforms should work correctly both with the "label:{label}" syntax and the "{fieldname}" syntax. So, if label:course is cf_888, both of these will work:
that means that if you don't need to do anything with the form, the "label:{label}" syntax is fine, but if you need to do validations and the like, you may be better off using the fieldname.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>jstest</title>
<script type="text/javascript" src="include/jquery/jquery-1.6.2.min.js"></script>
</head>
<body>
<form id='inform' name="inform">
<input name="label;course[]" />
<input name="label;course[]" />
<input type="submit">
</form>
<input name="label:course[]" />
<input name="label:course[]" />
<script type="text/javascript">
$( document ).ready(function() {
jQuery.each($("#inform :input"),function(index, elem) {
if (elem.name=='label;course[]') {
$(elem).val(index);
}
});
jQuery.each($("input[name='label:course[]']"),function(index, elem) {
$(elem).val(index);
});
});
</script>
</body>
</html>
Drop that into the root of your coreBOS install and it should work. Note how I have to change the colon for semi-colon in the name. Very strange.
My recommendation would be to use the field name: webforms should work correctly both with the "label:{label}" syntax and the "{fieldname}" syntax. So, if label:course is cf_888, both of these will work:
Code:
<input name="label:course[]" />
<input name="cf_888[]" />
that means that if you don't need to do anything with the form, the "label:{label}" syntax is fine, but if you need to do validations and the like, you may be better off using the fieldname.
Joe
TSolucio
TSolucio