PDA

View Full Version : integration JScript with Java programming?


JaiL
02-10-2003, 03:55 AM
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.

JaiL
02-10-2003, 07:05 AM
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

JaiL
02-11-2003, 01:35 AM
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.