I am using the excellent jquery form plugin to obtain form data, do some pre-submission processing, and pass the altered form on to a django view via ajax for some additional processing.
I have a jQuery form plugin "beforeSubmit" function to basically divide a form field by 12 if another "monthly/yearly" checkbox is checked, and pass the altered value on to django. I have a html form called "myForm" with a bunch of text inputs "amount1", "amount2", "amount3", etc. and two checkboxes for each text input "amount1my", "amount2my", "amount3my" etc. for the user to select whether "amount" fields are monthly or annual amounts (the checkbox values are "m" and "y") I bind the form in $(document).ready(function() : var options = { ... beforeSubmit: myBeforeSubmit, ... } $('#myForm').ajaxForm(options); } What I want to do is search the form data for a "y" value in any of the checkboxes, and if present, get the related amount field and divide by 12. the beforeSubmit function is basically this: function myBeforeSubmit(formData, jqForm, options) { //for loop to get the name of each formData name field containing "y" - I get this using match(/y/) - so far, so good ///strip the field name of the "my" to get the underlying "amount" field name and create new variable "theFieldName" for the resulting stripped string - so far, so good. //This all works to this point, but when I try to do the math on the field: formData.theFieldName.value = formData.theFieldName.value/12; // the jQuery Form plugin sees "theFieldName" as a form field name which of course does not exist } Question: it is possible to insert a variable in the formData.[field name].value statement? Mark