View Full Version : integration JScript with Java programming?
here's the situation...
the user is gonna input 2 dates(lets say, 01/01 and 03/01)..
i am gonna compute the total number of days(which is 3) from these two days, using JavaScript.
now, i have to insert the value into the database, where i use java programming as my core language, so how do i convert the Jscipt variable into a Jprogramming variable?
izzit possible, or impossible?
i hope i can hear comments from all of u gurus..
:D
glenngv
02-10-2003, 04:02 AM
put the value of the variable in a hidden field, so that when the page is submitted, the server-side language can retrieve the value.
doesnt seem to work... well, i believe the reason behind is that i sux at JS..
u see, i added a hidden type aka
<input type = "hidden" name = "datesTotal" value=document.formName.TotalDays>
TotalDays is the value of the total days between the two dates...
and the output is document.formName.TotalDays...
can anyone tell me the correct way of coding??
Mhtml
02-10-2003, 08:19 AM
<script language="javascript" type="text/javascript">
document.formName.datesTotal.value = document.formName.TotalDays.value;
</script>
Roelf
02-10-2003, 08:44 AM
why moving the value from one field to another, where the server can grab it from the first :p
Mhtml, can u explain more on yours code?:confused:
Roelf is right, i cant understand y is there a need to pass the value into another field...
glenngv
02-11-2003, 03:07 AM
is TotalDays a javascript variable or a text field?
I supposed it is a variable, thus:
//computation of TotalDays here...
document.formName.datesTotal.value = TotalDays;
where formName is the name of your form and datesTotal is the hidden field.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.