Hello

I'm collecting a number of values from various form elements:
textfield, radio, checkbox.

since some of the fields aren't require on my form, when I POST their
values they are returned as 'undefined'

is there a way in Jquery that would allow me to set all variables that
are undefined with a given value like "N/A" or even just ""?

for example, after the form is submitted, I'm using the following code
to populate my values:
                //cancer vars
                var cancerVal = $("input[name='cancer']:checked").val();
                var cancerTypeVal = $("#cancerType").val();
                var cancerDateVal = $("#cancerDate").val();
                var chemoCanVal = $("input[name='chemoCan']:checked").val();
                var radiationCanVal = 
$("input[name='radiationCan']:checked").val();
                var surgeryCanVal = $("input[name='surgeryCan']:checked").val();
                var otherCanMoreVal = 
$("input[name='otherCanMore']:checked").val();

doing something like:

var chemoCanVal ="";

before the submit does not seem to help.

Alternately, if there is a way that I can use a function to replace
all instances of 'undefined' with another value after the form is
submitted, that too would work.

thanks in advance!

cheers,
-robert

Reply via email to