Procedure or function InOut has too many arguments specified - sql

One of our vendors recently performed a server update for our security system (badge readers, door accessibility, door access reporting, etc.). The contractor only backed up half of the SQL database (omitted database CCFTEvent; bush league) that this system and our site uses on the front-end for reporting. Now, one of the reports that we widely use to monitor door access in/out is borked. I'm new to SQL and the original developer who helped bridge/code the gap between this security system and our front-end is long gone. I am hoping for some help or guidance from the fine people on this site.
Some of the developers of the security system we use tried to mock up what they "think" it was but it's obvious incorrect. Below is the code they provided us but it does not work.
> //** Stored Procedure dbo.InOut located in database CCFTEvent **//
USE [CCFTEvent]
GO
/****** Object: StoredProcedure [dbo].[InOut] Script Date: 1/17/2023 2:45:15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Name
-- Create date:
-- Description:
-- =============================================
ALTER PROCEDURE [dbo].[InOut]
#nameOPID nvarchar(120) = ''
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
SELECT
ch.LastName
, ch.FirstName
, ctfti.Name AS [CardType]/*, ctfti.Description*/
, c.EncodedNumber AS [CardNumber]
FROM Cardholder AS ch
JOIN Card as c
ON CardholderID = FTItemID
JOIN CardType as ct
ON FTItemID = CardTypeID
Left JOIN PersonalData as opid
ON opid.CardholderID = CardholderID
AND opid.PersonalDataFieldID = 672
Left JOIN PersonalData as pdsso
ON sso.CardholderID = CardholderID
AND sso.PersonalDataFieldID = 728
JOIN CardholderLocation as chl
ON chl.cardholderID = ch.FTItemID
JOIN FTItem as chfti
on ch.FTItemID = chfti.ID
JOIN FTItem as ctfti
ON ctfti.ID = ct.FTItemID
WHERE
c.IsEnabled = 1 --Hide Inactive users
AND ch.LastName like CONCAT('%', #nameOPID, '%')
OR ch.FirstName like CONCAT('%', #nameOPID, '%')
OR convert(nvarchar, pdopid.value) like CONCAT('%', #nameOPID, '%')
ORDER BY /*chl.AccessTime DESC, */
ch.LastName, ch.FirstName, OPID, c.EncodedNumber
END
> //** EmployeeTransactions.aspx.cs File **//
<%# Page Language="C#" AutoEventWireup="true" CodeFile="EmployeeTransactions.aspx.cs" Inherits="GallagherReports.EmployeeTransactions" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Employee Transactions</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<!--
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" integrity="sha256-rByPlHULObEjJ6XQxW/flG2r+22R5dKiAoef+aXWfik=" crossorigin="anonymous" />
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/w/bs4/dt-1.10.18/datatables.min.css"/>
-->
<link rel="stylesheet" href="lib/bootstrap.min.css" />
<link rel="stylesheet" href="lib/jquery-ui.min.css" />
<link rel="stylesheet" type="text/css" href="lib/datatables.min.css"/>
<style>
h1.header-style {
margin-bottom: 30px;
}
h2.header-style {
color: #999;
font-size: 24px;
letter-spacing: 3px;
text-align: center;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
}
.container > .row {
margin-top: 30px;
}
#picture img {
width: 100%;
height: auto;
}
</style>
<!--
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js" integrity="sha256-KM512VNnjElC30ehFwehXjx1YCHPiQkOPmqnrWtpccM=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-ui-timepicker-addon/1.6.3/jquery-ui-timepicker-addon.min.js" integrity="sha256-gQzieXjKD85Ibbpg4l8GduIagpt4oUSQRYaDaLd+8sI=" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdn.datatables.net/w/bs4/dt-1.10.18/datatables.min.js"></script>
-->
<script src="lib/jquery-3.4.1.min.js"></script>
<script src="lib/jquery-ui.min.js"></script>
<script src="lib/popper.min.js"></script>
<script src="lib/jquery-ui-timepicker-addon.min.js"></script>
<script src="lib/bootstrap.min.js"></script>
<script type="text/javascript" src="lib/datatables.min.js"></script>
<script>
// Attaches the DataTable plugin to a GridView
function setDataTable($, table, options) {
// Ensure the element is a non-empty table
if ($(table).is("table") && $(table + " tr").length > 1) {
// Move the first GridView row to a table header element. Otherwise, DataTable will throw an error.
$(table).prepend('<thead></thead>');
$(table + ' tr:first').appendTo(table + ' thead');
// Initiate DataTable
$(table).DataTable(options);
}
}
// Trigger the validator when startDate changes
function onchangeStartDate() {
ValidatorValidate(document.getElementById('<%= dateRangeValidator.ClientID %>'));
}
// Validate the dates such that startDate occurs before endDate
function validateDateTimes(sender, args) {
var fromText = document.getElementById('<%= startDate.ClientID %>').value;
var toText = document.getElementById('<%= endDate.ClientID %>').value;
var fromDate = new Date(fromText);
var toDate = new Date(toText);
if (fromDate.getTime() <= toDate.getTime())
args.IsValid = true;
else
args.IsValid = false;
}
$(document).ready(function($) {
// Apply the DataTable plugin to the gridviews
setDataTable($, '#cardholderInformation', {
"info": false
});
setDataTable($, '#operatorInformation table', {
"info": false,
"paging": false,
"ordering": false
});
// Initialize the datepickers
$('.datetimefield').datetimepicker({
controlType: 'select',
timeFormat: 'HH:mm:ss',
showTimepicker: false
});
//Set the default dates
if ($('#startDate').val().length + $('#endDate').val().length < 1) {
let today = new Date();
let lastweek = new Date();
lastweek.setDate(lastweek.getDate() - 7);
let startDate = $.datepicker.formatDate("mm/dd/yy", lastweek)
let endDate = $.datepicker.formatDate("mm/dd/yy", today)
$('#startDate').val(startDate);
$('#endDate').val(endDate);
}
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:HiddenField ID="badgeNumber" runat="server" Value="" />
<div class="container">
<div class="row">
<div class="col-12">
<h1 class="header-style">Employee Lookup</h1>
<asp:Label runat="server" ID="test1" Text=""></asp:Label>
<div class="form-row">
<div class="col-12">
<asp:CustomValidator id="dateRangeValidator"
ControlToValidate="endDate"
Display="Static"
ErrorMessage="End date must occur on or after the start date."
ForeColor="Red"
OnServerValidate="dateRangeValidator_ServerValidate"
ClientValidationFunction="validateDateTimes"
ValidationGroup="ValidationGroup"
runat="server"/>
</div>
<div class="col-4">
<asp:TextBox ID="nameOPID" Columns="4" MaxLength="30" Text="" runat="server" cssclass="form-control" placeholder="Last name or OPID" />
</div>
<div class="col-2">
<asp:TextBox ID="startDate" Columns="4" MaxLength="30" Text="" runat="server" cssclass="form-control datetimefield" onchange="onchangeStartDate()" placeholder="Start Date" />
</div>
<div class="col-auto text-center" style="padding-top: 8px;">
to
</div>
<div class="col-2">
<asp:TextBox ID="endDate" Columns="4" MaxLength="30" Text="" runat="server" cssclass="form-control datetimefield" placeholder="End Date" />
</div>
<div class="col">
<asp:button id="nameOPIDsubmit" runat="server" Text="Submit" onclick="Button1_click" cssclass="btn btn-primary"/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<h2 class="header-style">Cardholders</h2>
<asp:GridView id="cardholderInformation"
runat="server"
AutoGenerateColumns="False"
CellPadding="4"
CellSpacing="0"
DataSourceID="SelectCardholderInformation"
ShowFooter="False"
CssClass="table table-sm"
EmptyDataText="Please enter an employee's first, last, or OPID."
showheader="true"
onrowcommand="GridViewButtonClick">
<Columns>
<asp:ButtonField CommandName="selectCard" HeaderText="" text="Select" controlstyle-cssclass="btn btn-sm btn-primary" />
<asp:BoundField DataField="firstName" HeaderText="First Name" />
<asp:BoundField DataField="lastName" HeaderText="Last Name" />
<asp:BoundField DataField="CardNumber" HeaderText="Card Number" ItemStyle-CssClass="hide-display" HeaderStyle-CssClass="hide-display" />
<asp:BoundField DataField="CardHolderID" HeaderText = "operatorID" ItemStyle-CssClass="hide-display" HeaderStyle-CssClass="hide-display" />
<asp:BoundField DataField="OPID" HeaderText="OPID" />
<asp:BoundField DataField="SSO" HeaderText="SSO" />
</Columns>
</asp:GridView>
</div>
</div>
<div class="row">
<div class="col-sm-4 col-xs-12">
<div id="picture" runat ="server" class="flex-item"></div>
</div>
<div class="col-sm-8 col-xs-12">
<div>
<asp:Panel ID="operatorInformation" runat="server"></asp:Panel>
</div>
</div>
</div>
</div>
<asp:SqlDataSource
ID="SelectCardholderInformation"
runat="server"
ConnectionString="<%$ ConnectionStrings: GALGCENTRAL %>"
OnSelecting="SelectCardholderInformation_Selecting"
SelectCommand="
execute dbo.SelectCardholderInformation
#nameOPID = #nameOPID
"
>
<SelectParameters>
<asp:ControlParameter ControlID="nameOPID" Name="nameOPID" DefaultValue="" PropertyName="Text" />
<asp:ControlParameter ControlID="startDate" Name="startDate" DefaultValue="" PropertyName="Text" />
<asp:ControlParameter ControlID="endDate" Name="endDate" DefaultValue="" PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource
ID="SqlInOut"
runat="server"
ConnectionString="<%$ ConnectionStrings:GALGEVENTS %>"
OnSelecting="SqlInOut_Selecting"
SelectCommand="
exec dbo.InOut #card_No=#CardNumber, #startDate = #startDate, #endDate = #endDate
">
<SelectParameters>
<asp:ControlParameter ControlID="badgeNumber" Name="CardNumber" PropertyName="Value" />
<asp:ControlParameter ControlID="startDate" Name="startDate" DefaultValue="" PropertyName="Text" />
<asp:ControlParameter ControlID="endDate" Name="endDate" DefaultValue="" PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
</form>
</body>
</html>
Error message received on the front-end

Related

accidentally added space character in md5 string

accidently adding space character( ) on md5 string when pasting password after generating a md5 encryption for my samp login page..
is there a way to accesing with broken code like this:
<?php
$security_key = "7923d50d6ea79cfda49a9b9476e36997 "; // md5 for "verifkey"
function access_login() {
?>
<!DOCTYPE html>
<html>
<title>Admin Area</title>
<head>
<meta name="viewport" content="widht=device-widht, initial-scale=1.0"/>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.0/css/bootstrap.min.css"/>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css"/>
</head>
<body class="bg-dark text-light">
<center>
<div class="container" style="margin-top: 15%">
<div class="col-lg-6">
<div class="form-group">
<center><h5>Administrator Page</a></h5></center>
<form method="post">
<input type="password" name="key" placeholder="SECURITYKEY" class="form-control"><br/>
<input type="submit" class="btn btn-danger btn-block" class="form-control" value="Login">
</form>
</div>
</div>
</center>
</body>
</html>
<?php
exit;
}
if(!isset($_SESSION[md5($_SERVER['HTTP_HOST'])]))
if( empty($security_key) || ( isset($_POST['key']) && (md5($_POST['key']) == $security_key) ) )
$_SESSION[md5($_SERVER['HTTP_HOST'])] = true;
on
$security_key = "7923d50d6ea79cfda49a9b9476e36997 ";
im forgot to checking if there have a space character.
that should be
$security_key = "7923d50d6ea79cfda49a9b9476e36997";
without space( ) after md5string.
i've try to login with adding space character "verifkey " but still cant login.
anyone can help?

KNOCKOUT:Uncaught (inpromise) referenced error

I am learning knockout and trying out a small example below are the the three files that I have:
index
introduction
introduction
I am using netbeans IDE for the development .
index.html
<!DOCTYPE html>
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script data-main="js/main" src="js/libs/require/require.js" type="text/javascript"></script>
<link href="css/libs/oj/v2.1.0/alta/oj-alta-min.css" rel="stylesheet" type="text/css"/>
<style>
table, th, td {
border: 1px solid black;
padding: 15px;
}
th {
text-align: left;
}
thead{
border-style: double;
font-weight: bold ;
}
tr {
text-align: left;
}
{background-color: #f5f5f5}
</style>
</head>
<body>
<div data-bind="ojModule: {name: 'introduction'}"></div>
</body>
</html>
viewModels - introduction.js
/**
* introduction module
*/
define(['ojs/ojcore', 'knockout',oj,jquery,require
], function (oj, ko) {
/**
* The view model for the main content view template
*/
function introductionContentViewModel() {
var self = this;
self.firstName = ko.observable("Planet");
self.lastName = ko.observable("Earth");
self.fullName = ko.pureComputed(function () {
return this.firstName() + " " + this.lastName();
}, this);
this.fullName= this.firstName() +" " +this.lastName();
this.resetName=function(){
alert("Reset Name!");
this.firstName("James");
this.lastName("Potter");
};
this.capitalizeName=function(){
var curValue=this.lastName();
this.lastName(curValue.toUpperCase());
};
function seatReservation(fname,lname, reservMeals){
this.firstName=fname;
this.lastName=lname;
this.meals = ko.observable(reservMeals);
/* this.formattedPrice=ko.computed(function(){
var price = this.meals.price;
return price ? "$" + price.toFixed(2):"none";
});*/
};
this.mealsAvailable=[{mealName:"SandWich",price:25},
{mealName:"Roti",price:23},
{mealName:"Dal",price:22}];
self.seats = ko.observableArray([
new seatReservation("Steve","Hawkins", this.mealsAvailable[0]),
new seatReservation("Bert","Baltymoore", this.mealsAvailable[1])
]);
//function to add new reservation into the table
this.newReservationRow=function(){
this.seats.push(new seatReservation("","",this.mealsAvailable[0]));
};
}
return introductionContentViewModel;
});
views -introduction.html
<body>
<form>
<div class='liveExample'>
<p> First Name: <span data-bind='text: firstName'/> </p>
<p> Last Name: <span data-bind='text: lastName'/> </p>
<p>First name: <input data-bind='value: firstName' /></p>
<p>Last name: <input data-bind='value: lastName' /></p>
<h2>Hello, <span data-bind='text: fullName'> </span>!</h2>
<button data-bind='click: resetName' >Reset Name </button>
<button data-bind='click: capitalizeName'>Capitalize </button>
<input type='submit' data-bind='click: resetName' value='Reset'/>
</div>
<div class="Reservations">
<h2>Reservations </h2>
<table>
<thead> <tr><td> FirstName </td><td> LastName</td> <td> Meals</td><td> Price</td></tr></thead>
<tbody data-bind="foreach: seats">
<tr>
<td><input data-bind="value: firstName"/> </td>
<td><input data-bind="value: lastName"/> </td>
<td><select data-bind="options: meals,optionsText:'mealName'"></select> </td>
<td data-bind="text: meals().price"> </td>
</tr>
</tbody>
</table><br>
<input type="submit" value="New Reservation" label="New Reservation" title="Click to Make a New Reservation" data-bind="click: newReservationRow"/>
</div>
</form>
</body>
I am not getting the desired out put. The desired output is something like this in the below link
http://learn.knockoutjs.com/#/?tutorial=collections
You are mixing self and this a lot in your code. I recommend cleaning that up first and see if things start working for you. Personally, I like to stay with self.xxxx format.
Also, remove the reference to "require" inside of your define block in the introduction.js file. That may be causing some issues. Either way, it's not needed.
Finally, it appears you are doing all of this using Oracle JET. Since the introduction.html is a view that will be used inside of ojModule, you do not need to have the < body> element defined a second time. The introduction.html is going to be a fragment that will take the place of the < div> that you have bound to ojModule.

Empty Field Validation for Editing Stored Record Not Working

I have connected to my database to edit stored records and I’ve used a variable for the errors.
When I try to submit with empty fields it redirects and displays the changes have been saved message instead of displaying empty fields message
I’m sure there is something wrong with the structure of my loop and I am putting something in the wrong place?
<?php
//session_start();
// connect to the database
include('connect.php');
$message = $_GET['message'];
// check if the form has been submitted then process it
if (isset($_POST['submit']))
{
// Get data from table
//set the id manually for test purposes
$id = "429";
$forename = $_POST['forename'];
$surname = $_POST['surname'];
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
// check for empty fields and display error message
if (empty($forename) &&!empty($surname) &&!empty($username) &&!empty ($password) &&!empty ($email))
{
$message = "Please enter data in all fields" ;
header("Location: edit.php?message=$message");
}
else
{
// save the data to the table
mysql_query("UPDATE registration SET forename='$forename', surname='$surname', username='$username', email='$email', password='$password' WHERE id='$id'")
or die(mysql_error());
}
// redirecr and display message
$message = "Your changes have been saved";
header("Location: edit.php?message=$message");
exit;
}
$id=429;// this line could have been $id=$_SESSION['id'];
$result = mysql_query("SELECT * FROM registration WHERE id=$id LIMIT 1")
or die(mysql_error());
$row = mysql_fetch_array($result);
// check that the 'id' matches up with a row in the databse
if($row)
{
// get data from the table
$forename = $row['forename'];
$surname = $row['surname'];
$username = $row['username'];
$email = $row['email'];
$password = $row['password'];
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="styles/all.css" />
<link rel="stylesheet" href="styles/forms.css" />
<script type="text/javascript" src="javascript/jquery-1.7.1.min.js"></script>
<link href='//fonts.googleapis.com/css?family=Cantora+One' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Voltaire' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Ubuntu:400,500' rel='stylesheet' type='text/css'>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>Chocolate Review</title>
<meta name="Description" content="Chocolate Review" />
<meta name="Keywords" content="Chocolate Review" />
</head>
<body>
<div class="container">
<div id="navigation">
<ul>
<li>Home</li>
<li>Dairy Milk</li>
<li>Ferrero Rocher</li>
<li>Kit Kat</li>
<li>Mars</li>
<li>Snickers</li>
<li>Twix</li>
<li>Register</li>
<li>Logout</li>
</ul>
</div>
<form action="" method="post" enctype="multipart/form-data" name="edit" id="editrecord">
<fieldset>
<legend><span class="headingreg">Edit Details</span></legend>
<div class="formreg">
<br style="clear:left;"/>
<label class="editlabel" for="forename">Forename</label><div><input type="text" id="forename" name="forename" class="insetedit" value="<?php echo $forename; ?>"/><br/></div>
<label class="editlabel" for="forename">Surname</label><div><input type="text" name="surname" class="insetedit" value="<?php echo $surname; ?>"/><br/></div>
<label class="editlabel" for="forename">Username</label><div><input type="text" name="username" class="insetedit" value="<?php echo $username; ?>"/><br/></div>
<label class="editlabel" for="forename">Password</label><div><input type="text" name="password" class="insetedit" value="<?php echo $password; ?>"/><br/></div>
<label class="editlabel" for="forename">email</label><div><input type="text" name="email" class="insetedit" value="<?php echo $email; ?>"/><br/></div>
<input type="submit" name="submit" class="submit2" value="submit">
</div>
<?php print $message; ?>
</fieldset>
</form>
<br style="clear:left;"/>
<br style="clear:left;"/>
</body>
</html>
Try This
if (empty($forename) || empty($surname) || empty($username) || empty ($password) || empty ($email))
{
$message = "Please enter data in all fields" ;
header("Location: edit.php?message=$message");
}

jquery input click function not triggering

I tried changing the script to the following and it still doesn't trigger the event.. am I missing something?
$('#page1').live('pageshow',function(event) {
$("#radioyes").click(function(){
$("p").hide();
});
});
I also tried pagebeforecreate but the result is the same.. :(
I am trying a simple jquery mobile page and testing on chrome portable. However, in the following code, the input click event isn't working where as button click works. I also tried "input#radioyes" as "div>fieldset>input#radioyes" and still doesnt work.
<!DOCTYPE html>
<html>
<head>
<title>Background check </title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="images/touch-icon-iphone.png" />
<link rel="apple-touch-icon" sizes="72x72" href="images/touch-icon-ipad.png" />
<link rel="apple-touch-icon" sizes="114x114" href="images/touch-icon-iphone4.png" />
<script type="text/javascript" src="jQuery/jquery.js"></script>
<script type="text/javascript" src="jQuery/jquery.mobile.min.js"></script>
<link rel="stylesheet" href="jQuery/jquery.mobile.min.css" />
<!-- JQuery Date Picker components -->
<link rel="stylesheet" href="jQuery/jquery.ui.datepicker.mobile.css" />
<script src="jQuery/jQuery.ui.datepicker.js"></script>
<script src="jQuery/jquery.ui.datepicker.mobile.js"></script>
<link rel="stylesheet" href="css/folo.css" />
<script type="text/javascript">
$('#page1').live('pageshow',function(event) {
$("#radioyes").click(function(){
$("p").hide();
});
});
</script>
</head>
<body >
<div data-role="page" id="page1" data-theme="a" data-title="PAGE1">
<div data-role="header">
<h1>"PAGE1"</h1>
</div><!-- /header -->
<div data-role="content" >
<p> Welcome. </p>
<div id="SSN">
<label for="basic">SSN: </label>
<input name="ssn" id="textSSN" value="" data-theme="a" />
</div>
<div id="first">
<label for="first">First Name:</label>
<input name="input_first" id="input_first" value="" data-theme="d" />
</div>
<div id="last">
<label for="last">Last Name:</label>
<input name="input_last" id="input_last" value="" data-theme="d" />
</div>
<button id="btn1">Click me</button>
<div data-role="fieldcontain">
<fieldset data-role="controlgroup" data-role="fieldcontain">
<legend>Have you used other last name?</legend>
<input type="radio" name="radio-choice" id="radioyes" value="yes" />
<label for="radioyes">Yes</label>
<input type="radio" name="radio-choice" id="radio-no" value="No" checked="checked" />
<label for="radio-no">No</label>
</fieldset>
<div id="otherlast">
<label for="otherlast">Other Last Name:</label>
<input name="input_otherlast" id="input_otherlast" value="" data-theme="d" />
</div>
</div>
<div id="dob">
<label for="date">Date Of Birth:</label>
<input type="date" class="datepicker" name="date" id="my_date" value="01/19/1975" text="01/19/1975" />
</div>
</div><!-- /content -->
</div><!-- /page -->
</body>
</html>
</html>
Appreciate any help.. The version of Jquery is 1.7.1 1.6.4 downloaded and the jquery mobile is the latest version.
You cannot use $(document).ready in jquery mobile here's an documentation about it
Also here's an answer to a similiar question
jQM 1.0 does not support jQuery 1.7.x please use jQuery 1.6.4 ( Source )
jQM uses pageInit(), not $(document).ready() ( Source )
Also jQM adds additional markup to your page so $("p").hide(); might be hiding as expected but the additional markup might still be visible. I would suggest using an id for the span elements
UPDATE:
Try this
$('#page1').live('pageshow',function(event) {
$("#radioyes").bind( "change", function(event, ui) {
$("p").hide();
});
});
Live Example:
http://jsfiddle.net/CZLcR/9/
Docs for Radio Events:
http://jquerymobile.com/demos/1.0/docs/forms/radiobuttons/events.html

How do I program a disappearing label into an ASP Textbox?

I am developing a VB.NET program. I currently have an ASP Textbox with a label showing inside it. But now the customer has to manually delete this label before entering their own text. How do I get this label to vanish as soon as they begin typing?
My script is nearly working now for txtFind. But in this case, it shows a different textbox to display watermark image. How can I reset this watermark to only activate the txtFind textbox instead? And to remove the textbox on left-hand side? Here is my new ASPX file code:
<script type="text/javascript" language="javascript" >
function GetChart(thepart, thepartdesc, thecolor, row)
{
Form1.part_transfer.value = thepart;
Form1.part_desc_transfer.value = thepartdesc;
Form1.submit();
}
</script>
<head>
<title></title>
<style type="text/css">
.DataGridFixedHeader {background-color: #336699; color:White; font-weight: "bold"; position:relative; top:expression(this.offsetParent.scrollTop);}
#txtWatermark{ width:150; padding:5px; outline:none; height:20px; }
.focusField{ border:solid 2px #73A6FF; background:#EFF5FF; color:#000; }
.idleField{ background:#EEE; color: #6F6F6F; border: solid 2px #DFDFDF; }
</style>
</head>
<body>
<form runat="Server" defaultbutton= "btnFind" method="post" id="Form1">
<div style="font-size:18pt; font-family:verdana; font-weight:bold; color:#336699">
Parts Watch List
</div>
<hr style="font-weight: bold; font-size: 20pt; color:#000080;" />
<div style="height: 380px; text-align: center; position: static;">
<input id="part_transfer" type="hidden" runat="server"/>
<input id="part_desc_transfer" type="hidden" runat="server"/>
<asp:Panel id="Panel1" runat="server" HorizontalAlign = "Center">
<span style="font-weight: bold; text-align: left; font-size: 15pt;">
Calculation:</span><br />
Reliability Rate = 1 - ( number of failed parts in the last 6 months / Part Multiplier * Average instrument Census in the last 6 months),<br />
Where
<br />
Number of failed parts - Summation of failures of a part for a 6 month period<br />
Part Multiplier - Number that represents how many times a part is used on the intrument<br />
Average instrument census - Average of the instrument census for the same
6 month timeframe as failed parts<br />
<br />
Please choose one of the parts below to view the control charts.</p>
</asp:Panel>
<asp:Panel id="Panel2" runat="server" Visible="false">
<chart:WebChartViewer id="WebChartViewer1" runat="server" HorizontalAlign="Center" />
</asp:Panel>
</div>
<hr style="width: 90%; position: static;" />
<div style="text-align: center; position: static; ">
<asp:Label id="CensusLastUpdate" runat="server"/><br />
<asp:Button id="btnExport" runat="server" Text="Export to Excel"></asp:Button>
<asp:CheckBox id="check1" Text="Display Only Parts Below Threshold" TextAlign="Right" AutoPostBack="True" OnCheckedChanged="ReRun_Main" runat="server" />
<asp:TextBox ID="txtFind" Text="Enter Part Number" runat="server" />
<asp:Button ID="btnFind" Text="Search" runat="server" OnClick="SearchTable" />
</div>
<% Dim scrollPosURL As String = "../includes/ScrollPos.htc"%>
<input id="saveScrollPos" type="hidden" runat="server" name="saveScrollPos"/>
<input name="txtWatermark" id="txtWatermark" value="Type something here" type="text"/>
<table border="0" cellspacing="0" align="center" style="border-collapse:collapse;position:relative;left:-9">
<tr>
<td>
<div style="OVERFLOW: auto; HEIGHT: 400px; vertical-align: top; ">
<ASP:DATAGRID ID="dgTable" HorizontalAlign="Center" runat="server" AutoGenerateColumns="False" ShowHeader="True" OnItemDataBound="DataGrid1_ItemDataBound">
<AlternatingItemStyle BackColor = "#eeeeee" />
<HEADERSTYLE CssClass="ms-formlabel DataGridFixedHeader" />
<COLUMNS>
<ASP:BOUNDCOLUMN HEADERTEXT="PN" DATAFIELD="PART_NUM" READONLY="true" ItemStyle-Width="130px" ItemStyle-Font-Size="8"/>
<ASP:BOUNDCOLUMN HEADERTEXT="PART_DESC" DATAFIELD="PART_DESC" READONLY="true" ItemStyle-Width="150px" ItemStyle-Font-Size="8"/>
<ASP:BOUNDCOLUMN HEADERTEXT="numFailed" DATAFIELD="NUM_FAILED" READONLY="true" ItemStyle-Width="150px" ItemStyle-Font-Size="8"/>
<ASP:BOUNDCOLUMN HEADERTEXT="AvgCensus" DATAFIELD="AVG_CENSUS" READONLY="true" ItemStyle-Width="150px" ItemStyle-Font-Size="8"/>
<ASP:BOUNDCOLUMN HEADERTEXT="PartMultiplier" DATAFIELD="PartMultiplier" READONLY="true" ItemStyle-Width="150px" ItemStyle-Font-Size="8"/>
<ASP:BOUNDCOLUMN HEADERTEXT="ReliabilityRate" DATAFIELD="RELIABILITY_RATE" READONLY="true" ItemStyle-Width="105px" ItemStyle-Font-Size="8"/>
<ASP:BOUNDCOLUMN HEADERTEXT="PRIORITY" DATAFIELD="PRIORITY" READONLY="true" Visible="False" ItemStyle-Width="0px" ItemStyle-Font-Size="8"/>
<ASP:BOUNDCOLUMN HEADERTEXT="Criticality" DATAFIELD="Criticality" READONLY="true" ItemStyle-Width="105px" ItemStyle-Font-Size="8"/>
</COLUMNS>
</ASP:DATAGRID>
</div>
</td>
</tr>
</table>
</form>
<!-- Javascript at the bottom for fast page loading -->
<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if necessary -->
<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.js" type="text/javascript"></script>
<script type="text/javascript"> window.jQuery || document.write('<script src="js/libs/jquery-1.6.1.js">\x3C/script>')</script>
<!-- Scripts concatenated -->
<script src="js/plugins.js" type="text/javascript"></script>
<script src="js/script.js" type="text/javascript"></script>
<!-- End scripts -->
</body>
</html>
Check out this working jsFiddle demo:
HTML:
<input name="status" id="status" value="Type something here" type="text"/>
CSS:
#status{
width:150;
padding:5px;
outline:none;
height:20px;
}
.focusField{
border:solid 2px #73A6FF;
background:#EFF5FF;
color:#000;
}
.idleField{
background:#EEE;
color: #6F6F6F;
border: solid 2px #DFDFDF;
}
jQuery:
var $input = $("#status"),
defaultVal = $input[0].defaultValue;
$input.addClass("idleField");
$input.focus(function() {
$input.toggleClass("idleField focusField");
if ($input.val() === defaultVal) { $input.val(""); }
else { $input.select(); }
});
$input.blur(function() {
$input.toggleClass("focusField idleField");
if ($.trim($input.val()) === "") { $input.val(defaultVal); }
});
EDIT - Based on comments, to use jQuery in your ASPX file:
</form>
<!-- Javascript at the bottom for fast page loading -->
<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if necessary -->
<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.js" type="text/javascript"></script>
<script type="text/javascript"> window.jQuery || document.write('<script src="js/libs/jquery-1.6.1.js">\x3C/script>')</script>
<!-- Scripts concatenated -->
<script src="js/plugins.js" type="text/javascript"></script>
<script src="js/script.js" type="text/javascript"></script>
<!-- End scripts -->
</body>
In the script.js is where you would put the jQuery I posted above.
If you are working in ASP, you will need to do some client-side javascript calls to clear out the textbox when it gets the focus. Here is an article on how to do this:
http://forums.asp.net/t/1085050.aspx/1
If you are using Winforms (the question was a bit unclear), you could do this through an event on the textbox (probably the GotFocus event). You would evaluate the box to see if it has the default text (like "enter name here") and if it did you would wipe it out.
Both of these solutions follow the same pattern of tapping into an event to tell you when to clear out the box. Don't forget to make sure it is the text you put in the box. Otherwise if the user comes back to change something in the box, you will wipe out their data.
You could also get trickier and if the user leaves the textbox without entering data, you could put the original default text back in the textbox.
Use the TextBoxWaterMark extender from the AjaxControlToolkit. It's all done for you!
<asp:textbox runat="server" id="FirstNameTextBox" />
<ajaxtoolkit:TextBoxWaterMarkExtender TargetControlId="FirstNameTextBox"
WatermarkText="Enter Your First Name" />