Hi all
i am doing form submit when press enter this is working perfect mean while i am dong another forum autocomplete but is now working. but only autocomplete form working fine. where i am wrong please tell me thank you...
<head>
<link rel="stylesheet" type="text/css" media="all" href="./style.css"/>
<link rel="stylesheet" href="./autostyle.css">
<script src="./js/jquery-1.7.2.js"></script>
<script src="./js/jquery.ui.core.js"></script>
<script src="./js/jquery.ui.widget.js"></script>
<script src="./js/jquery.ui.position.js"></script>
<script src="./js/jquery.ui.autocomplete.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="./js/jquery.min.js"></script> <script src="./js/jquery.nicescroll.min.js"></script>
<script>
// placeholder polyfill
$(document).ready(function(){
function add() {
if($(this).val() == ''){
$(this).val($(this).attr('placeholder')).addClass('placeholder');
}
}
function remove() {
if($(this).val() == $(this).attr('placeholder')){
$(this).val('').removeClass('placeholder');
}
}
// Create a dummy element for feature detection
if (!('placeholder' in $('<input>')[0])) {
// Select the elements that have a placeholder attribute
$('input[placeholder], textarea[placeholder]').blur(add).focus(remove).each(add);
// Remove the placeholder text before the form is submitted
$('form').submit(function(){
$(this).find('input[placeholder], textarea[placeholder]').each(remove);
});
}
});
function handleKeyEvent(e) {
var charCode;
if (e && e.which) {
charCode = e.which;
} else if (window.event) {
e = window.event;
charCode = e.keyCode;
}
if (e.keyCode == 13 && e.shiftKey)
{
//this is the shift+enter right now it does go to a new line
}
else if (charCode == 13) {
document.getElementById("searchform").submit();
}
}
</script>
<script>
$(document).ready(function()
{
var nice = $("body").niceScroll(); // The document page (body)
});
</script>
<script>
$(function() {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$( "#indela" ).autocomplete({
source: availableTags,
select: function(event, ui) {
$("#indela").val(ui.item.label);
$("#searchform1").submit(); }
});
});
</script>
</head>
<body>
<div id="main" class="widget">
<div id="commentform" class="fromclass">
<form name="MyForm" method="get" action="actionfeed2.jsp" id="searchform">
<textarea rows="4" name="message" id="message" placeholder='Write a comment...' onkeypress="handleKeyEvent(event);" /></textarea>
<input type="hidden" name="companyid" value="777">
<input type="hidden" name="storeid" value="778">
<input type="hidden" name="barcode" value="1001"><br />
</form>
</div>
<form name="MyForm" method="get" action="actionfeed2.jsp" id="searchform1">
<input type="text" id="indela" name="companyid" autocomplete="off" style="width:200px;" >
<input type="hidden" name="storeid" value="778">
<input type="hidden" name="barcode" value="1001"><br />
</form>