jQuery in Action, 3rd edition
The moose likes HTML, CSS and JavaScript and the fly likes Newbie need help with textfield value. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Newbie need help with textfield value." Watch "Newbie need help with textfield value." New topic

Newbie need help with textfield value.

vanan saravanan
Ranch Hand

Joined: Jun 02, 2006
Posts: 95
Hi, i have the following script.

<script type="text/javascript">

function checkDate(nForm){

var sDate = nForm['dc1'].value;
sDate = sDate.split('-');
sDate = new Date(sDate[2],sDate[1]-1,sDate[0])
var eDate = nForm['dc2'].value;
eDate = eDate.split('-');
eDate = new Date(eDate[2],eDate[1]-1,eDate[0])
nForm['daysApart'].value = (eDate-sDate)/86400000;


return true;


How do i put the below value into a hidden text field.

Pavan Keely
Ranch Hand

Joined: Jun 30, 2006
Posts: 62

Use nForm.hiddenFieldName.value = nForm['daysApart'].value;

Pavan Keely

Pavan Keely<br /><a href="http://keelypavan.blogspot.com" target="_blank" rel="nofollow">http://keelypavan.blogspot.com</a>
wood burning stoves
subject: Newbie need help with textfield value.
It's not a secret anymore!