/    Sign up×
Community /Pin to ProfileBookmark

get value from input field

Hello i am using a simple calendar date picker in which when u click a date is displayed in an input field.
Using a javascript i am trying to retrieve data from a second page using this value but probably i am doing something wrong.

1st page:

[CODE] <script type=”text/javascript”>
function showCustomer(str)
{
if (str==””)
{
document.getElementById(“txtHint”).innerHTML=””;
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject(“Microsoft.XMLHTTP”);
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById(“txtHint”).innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open(“GET”,”check6.asp?q=”+str,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form>
Check in:
<input onchange=”showCustomer(this.value)” size=”22″ id=”f_date1″ /><button id=”f_btn1″>…</button>
<script type=”text/javascript”>//<![CDATA[
var cal = Calendar.setup({
onSelect: function(cal) { cal.hide() },
showTime: true
});
cal.manageFields(“f_btn1”, “f_date1”, “%Y-%m-%d”);
//]]></script>
</form>
<br />
<div id=”txtHint”>here…</div>
</body>
</html>
[/CODE]

and in second one i am trying to get date like this:

[CODE]
sql_cmd.CommandText = “SELECT dbo.rooms.id, type, image, price,details FROM dbo.rooms, dbo.transactions WHERE dbo.rooms.id=dbo.transactions.roomid and ‘” & request.querystring(“q”) & “‘ not between checkin and checkout”

[/CODE]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @garevn spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...