I have a javascript function in which if a user select future date then a pop up will appear and that pop up will contain an text box and a button.The user enter the value in the text box and click on the Button of child pop up.I want to capture those value in the parent window but i m not able to do it.
Below is the javascript which i had written:-
function CheckDateEalier(sender, args)
{
var toDate = new Date();
toDate.setMinutes(0);
toDate.setSeconds(0);
toDate.setHours(0);
toDate.setMilliseconds(0);
if (sender._selectedDate < toDate)
{
alert("You can't select day earlier than today! In Case if you are selecting Previous date then, By default it will take current Date.");
sender._selectedDate = toDate;
//set the date back to the current date
sender._textbox.set_Value(sender._selectedDate.format(sender._format))
}
if (sender._selectedDate > toDate) {
var timeSpent = window.open("EnterTimeSpent.aspx", "List", "scrollbars=no,resizable=no,width=320,height=100");
document.getElementById('<%= hiddenFieldFutureDateSelectTimeSpent.ClientID%>').value = timeSpent;
}
}
javascript on Child page:-
<script language="javascript" type="text/javascript">
function Parent() {
var timespent = Input.elements["timespent"].value;
//window.opener.UpdateValues(3);
window.returnValue = timespent;
self.close();
}
Child Page Code Behind:-
<form name="Input" method="post" action="">
<table>
<tr>
<td><input type="text" name="timespent" style="font-size:small;font-weight:bold;"></input>
</tr>
<tr>
<td>
<input type="button" value="Submit" class="button small green rounded" onClick="Parent()"></input>
</td></tr>
</table>
</form>
When i am debugging then i found that on the parent page , i m not able to capture the timespent send from child,It is displaying it as object.Please help me out that what the mistake i m doing and how i capture the value of textbox of child page in parent.
Why dont you use ‘prompt’ which already has this functionality;
var t=prompt(“timespent”,””);
If you need styling you could use jprompt(http://www.abeautifulsite.net/blog/2008/12/jquery-alert-dialogs)