expinch
08-04-2004, 08:04 AM
I have two variables that I'm sending in a form to another php page. One of the variables is sent in a hidden form:
<input name="currentWeek" type="hidden" value="$week">
and another is contained in a select box:
<select name="weekSpan"><option value="1">1</option><option value="2">2</option>
<option value="3">3</option><option value="4">4</option><option value="5">5</option></select>
I'm assuming that all data send through an html form is converted to a string in Javascript because they're all contained in quotes??
The "currentWeek" variable contains the present week and "weekSpan" holds the total weeks the data is valid. I read the values out fine...
var weekSpan = document.forms[0].weekSpan.value;
var currentWeek = document.forms[0].currentWeek.value;
var finalWeek = currentWeek+weekSpan;
I want to "confirm" that the data is correct...
var confirmed = confirm('Are you sure you want this draft sheet to last from week '+currentWeek+' to week '+finalWeek+'?');
..but as you can guess the finalWeek value is just the two values contatenated, not added together. I have no idea how to convert these values to ints, or if there is some way to send them as ints with the form? Thanks.
<input name="currentWeek" type="hidden" value="$week">
and another is contained in a select box:
<select name="weekSpan"><option value="1">1</option><option value="2">2</option>
<option value="3">3</option><option value="4">4</option><option value="5">5</option></select>
I'm assuming that all data send through an html form is converted to a string in Javascript because they're all contained in quotes??
The "currentWeek" variable contains the present week and "weekSpan" holds the total weeks the data is valid. I read the values out fine...
var weekSpan = document.forms[0].weekSpan.value;
var currentWeek = document.forms[0].currentWeek.value;
var finalWeek = currentWeek+weekSpan;
I want to "confirm" that the data is correct...
var confirmed = confirm('Are you sure you want this draft sheet to last from week '+currentWeek+' to week '+finalWeek+'?');
..but as you can guess the finalWeek value is just the two values contatenated, not added together. I have no idea how to convert these values to ints, or if there is some way to send them as ints with the form? Thanks.