Changing Textbox Value
Posted: Mon Aug 23, 2004 3:31 pm
I have a hidden textbox and a button. When the button is pressed I want to add todays date to the textbox. Here is what I have but it's not working.
and my javascript is
Can someone tell me what I'm doing wrong. The date is fine but it tells me the txt is null.
Code: Select all
<?php
<input type="hidden" name="txtDateVerified'.$id.'"><input type="Submit" name="btnVerified'.$id.'" value="Verified" onClick="addVerified(this.form,txtDateVerified'.$id.',''' . $id . ''')">
?>Code: Select all
<script language="javascript">
function addVerified(frm,txt,id){
dt = new Date();
month = dt.getMonth()+1;
day = dt.getDate();
year = dt.getFullYear();
verifieddate = year + '-' + month + '-' + day;
frm.txt.value = verifieddate;
}
</script>