Coast Line
asked on
javascript or jquery
Hi, I have the following code a mixture of jquery and javascript and i want that when i click my button, it calls the function onClick event and i want the error message to appear for 2 seconds and should hide, but currently they are not doingas such
In front end i am showing the error in the Span and the Label tags whose display:none; has been set initially
So pleae guide what is wrong in this
function mydata(frmname)
{
var r = $("select#reasonName").val();
if($('#pList').is(':empty')) {
$("span#error").show().delay(2000).queue(function(n) {
$(this).hide(); n();
});
}
else if (r == 0) {
$("label#mylabel_error").show().delay(2000).queue(function(n) {
$(this).hide(); n();
});
$("select#reasonName").focus();
return false;
}
var lstProjects = document.getElementById("mylist").value;
var reasons = document.getElementById("reasonName").value;
ColdFusion.navigate('abc.cfm?ID='+mylist+'&rs='+reasonName,'div','','');
}
In front end i am showing the error in the Span and the Label tags whose display:none; has been set initially
So pleae guide what is wrong in this
ASKER
well do not where do i place my other calls
Try this, backup current "function mydata(frmname)" and replace the "if" statement inside it with this one:
if($('#pList').is(':empty')) {
setTimeout(function() {
$("span#error").dialog();
},2000);
}
else if (r == 0) {
setTimeout(function() {
$("label#mylabel_error").dialog();
},2000);
$("select#reasonName").focus();
return false;
}
ASKER
but i need that mydata code also, i know this will work, i need implementation with that that
Regards
Regards
function mydata(frmname)
{
var r = $("select#reasonName").val ();
if($('#pList').is(':empty' )) {
setTimeout(function() {
$("span#error").dialog();
},2000);
}
else if (r == 0) {
setTimeout(function() {
$("label#mylabel_error").d ialog();
},2000);
$("select#reasonName").foc us();
return false;
}
var lstProjects = document.getElementById("m ylist").va lue;
var reasons = document.getElementById("r easonName" ).value;
ColdFusion.navigate('abc.c fm?ID='+my list+'&rs= '+reasonNa me,'div',' ','');
}
{
var r = $("select#reasonName").val
if($('#pList').is(':empty'
setTimeout(function() {
$("span#error").dialog();
},2000);
}
else if (r == 0) {
setTimeout(function() {
$("label#mylabel_error").d
},2000);
$("select#reasonName").foc
return false;
}
var lstProjects = document.getElementById("m
var reasons = document.getElementById("r
ColdFusion.navigate('abc.c
}
Forgot to enclose it on code, BTW you probably need to use "lstProjects" instead of "mylist" and "reasons" instead of "reasonName" inside of your Colfusion.navigate function
ASKER
i get this issue
$("span#error").dialog is not a function
$("span#error").dialog is not a function
My bad...
dialog() is a function in jQuery UI, not only is jQuery needed, bu also jQuery UI... you can download it from the site:
http://jqueryui.com/downlo ad
or load it from google CDN:
http://ajax.googleapis.com /ajax/libs /jqueryui/ 1.8.16/jqu ery-ui.min .js
and here's the dialog() documentation page:
http://jqueryui.com/demos/ dialog/
dialog() is a function in jQuery UI, not only is jQuery needed, bu also jQuery UI... you can download it from the site:
http://jqueryui.com/downlo
or load it from google CDN:
http://ajax.googleapis.com
and here's the dialog() documentation page:
http://jqueryui.com/demos/
ASKER
i do not want the dialog UI
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
Hope it helps