Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #19924 > unrolled thread
| Started by | "Tony" <tony.johansson@inport.com> |
|---|---|
| First post | 2013-05-24 16:43 +0200 |
| Last post | 2013-05-25 00:09 +0100 |
| Articles | 7 — 5 participants |
Back to article view | Back to comp.lang.javascript
I have a problem "Tony" <tony.johansson@inport.com> - 2013-05-24 16:43 +0200
Re: I have a problem tony@mountifield.org (Tony Mountifield) - 2013-05-24 15:22 +0000
Re: I have a problem "Tony" <tony.johansson@inport.com> - 2013-05-24 17:45 +0200
Re: I have a problem "Tony" <tony.johansson@inport.com> - 2013-05-24 17:29 +0200
Re: I have a problem Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-24 22:14 +0000
Re: I have a problem Christoph Becker <cmbecker69@gmx.de> - 2013-05-25 00:51 +0200
Re: I have a problem Tim Streater <timstreater@greenbee.net> - 2013-05-25 00:09 +0100
| From | "Tony" <tony.johansson@inport.com> |
|---|---|
| Date | 2013-05-24 16:43 +0200 |
| Subject | I have a problem |
| Message-ID | <knnu36$mnl$1@dont-email.me> |
The principle is this when I tab on field with id=fartygID I need to
validate this field against table AFARTYG and this is done asynchronously
and this can't be changed because of the
structure of the code.
If the data.opExist == "False" in function Validate I know that the entered
data is invalid and I want the cursor
to stay in the same field.
I have tried to use $("#fartygID").focus(); to position the cursor in the
fartygID field
but this does not work.
It would be easy if I could return the value of data.opExist but this seems
to be impossible because of that I use asynchronous call.
Is it anyone that have any suggestion how I can place the cursor on field
with id=fartygID
if the data.opExist == "False" ?
//Here is the function that validate. check_generic is called asynchronously
function Validate(ctrlID, ipTable, ipKey, ipKeyValue)
{
var ipDescriptionField = "";
check_generic(ipTable, ipKey, ipDescriptionField, ipKeyValue,
function (data, textStatus, jqXHR)
{
IsOkMessageShort(data.dsError);
if (data.opExist == "False")
{
$("#fartygID").focus(); //Invalid value don't leave
fartygID
}
});
}
function TabOn_FartygInDialog(e)
{
var TABKEY = 9;
if (e.keyCode == TABKEY)
{
Validate("fartygID", "AFARTYG", "FARTNR", "",
$('#fartygID').val());
// this.value += " ";
// if (e.preventDefault)
// {
// e.preventDefault();
// }
// return false;
}
}
//Tony
[toc] | [next] | [standalone]
| From | tony@mountifield.org (Tony Mountifield) |
|---|---|
| Date | 2013-05-24 15:22 +0000 |
| Message-ID | <kno0jp$lj$1@softins.clara.co.uk> |
| In reply to | #19924 |
In article <knnu36$mnl$1@dont-email.me>,
Tony <tony.johansson@inport.com> wrote:
> The principle is this when I tab on field with id=fartygID I need to
> validate this field against table AFARTYG and this is done asynchronously
> and this can't be changed because of the
> structure of the code.
>
> If the data.opExist == "False" in function Validate I know that the entered
> data is invalid and I want the cursor
> to stay in the same field.
> I have tried to use $("#fartygID").focus(); to position the cursor in the
> fartygID field
> but this does not work.
>
> It would be easy if I could return the value of data.opExist but this seems
> to be impossible because of that I use asynchronous call.
>
> Is it anyone that have any suggestion how I can place the cursor on field
> with id=fartygID
> if the data.opExist == "False" ?
Try using setTimeout(function() { $("#fartygID").focus(); }, 10);
The 10 is a number of milliseconds to delay before doing the focus. Adjust
as required.
Cheers
Tony
> //Here is the function that validate. check_generic is called asynchronously
> function Validate(ctrlID, ipTable, ipKey, ipKeyValue)
> {
> var ipDescriptionField = "";
>
> check_generic(ipTable, ipKey, ipDescriptionField, ipKeyValue,
> function (data, textStatus, jqXHR)
> {
> IsOkMessageShort(data.dsError);
>
> if (data.opExist == "False")
> {
> $("#fartygID").focus(); //Invalid value don't leave
> fartygID
> }
> });
> }
>
>
> function TabOn_FartygInDialog(e)
> {
> var TABKEY = 9;
> if (e.keyCode == TABKEY)
> {
> Validate("fartygID", "AFARTYG", "FARTNR", "",
> $('#fartygID').val());
>
> // this.value += " ";
> // if (e.preventDefault)
> // {
> // e.preventDefault();
> // }
> // return false;
> }
> }
>
> //Tony
>
--
Tony Mountifield
Work: tony@softins.co.uk - http://www.softins.co.uk
Play: tony@mountifield.org - http://tony.mountifield.org
[toc] | [prev] | [next] | [standalone]
| From | "Tony" <tony.johansson@inport.com> |
|---|---|
| Date | 2013-05-24 17:45 +0200 |
| Message-ID | <kno1nr$cpv$1@dont-email.me> |
| In reply to | #19926 |
Yes now it works perfect
many thanks Tony Mountifield
//Tony
"Tony Mountifield" wrote in message news:kno0jp$lj$1@softins.clara.co.uk...
In article <knnu36$mnl$1@dont-email.me>,
Tony <tony.johansson@inport.com> wrote:
> The principle is this when I tab on field with id=fartygID I need to
> validate this field against table AFARTYG and this is done asynchronously
> and this can't be changed because of the
> structure of the code.
>
> If the data.opExist == "False" in function Validate I know that the
> entered
> data is invalid and I want the cursor
> to stay in the same field.
> I have tried to use $("#fartygID").focus(); to position the cursor in the
> fartygID field
> but this does not work.
>
> It would be easy if I could return the value of data.opExist but this
> seems
> to be impossible because of that I use asynchronous call.
>
> Is it anyone that have any suggestion how I can place the cursor on field
> with id=fartygID
> if the data.opExist == "False" ?
Try using setTimeout(function() { $("#fartygID").focus(); }, 10);
The 10 is a number of milliseconds to delay before doing the focus. Adjust
as required.
Cheers
Tony
> //Here is the function that validate. check_generic is called
> asynchronously
> function Validate(ctrlID, ipTable, ipKey, ipKeyValue)
> {
> var ipDescriptionField = "";
>
> check_generic(ipTable, ipKey, ipDescriptionField, ipKeyValue,
> function (data, textStatus, jqXHR)
> {
> IsOkMessageShort(data.dsError);
>
> if (data.opExist == "False")
> {
> $("#fartygID").focus(); //Invalid value don't leave
> fartygID
> }
> });
> }
>
>
> function TabOn_FartygInDialog(e)
> {
> var TABKEY = 9;
> if (e.keyCode == TABKEY)
> {
> Validate("fartygID", "AFARTYG", "FARTNR", "",
> $('#fartygID').val());
>
> // this.value += " ";
> // if (e.preventDefault)
> // {
> // e.preventDefault();
> // }
> // return false;
> }
> }
>
> //Tony
>
--
Tony Mountifield
Work: tony@softins.co.uk - http://www.softins.co.uk
Play: tony@mountifield.org - http://tony.mountifield.org
[toc] | [prev] | [next] | [standalone]
| From | "Tony" <tony.johansson@inport.com> |
|---|---|
| Date | 2013-05-24 17:29 +0200 |
| Message-ID | <kno0oj$6o5$1@dont-email.me> |
| In reply to | #19924 |
I solved it by first using blur
and then in the function called from blur use focus
//Tony
"Tony" wrote in message news:knnu36$mnl$1@dont-email.me...
The principle is this when I tab on field with id=fartygID I need to
validate this field against table AFARTYG and this is done asynchronously
and this can't be changed because of the
structure of the code.
If the data.opExist == "False" in function Validate I know that the entered
data is invalid and I want the cursor
to stay in the same field.
I have tried to use $("#fartygID").focus(); to position the cursor in the
fartygID field
but this does not work.
It would be easy if I could return the value of data.opExist but this seems
to be impossible because of that I use asynchronous call.
Is it anyone that have any suggestion how I can place the cursor on field
with id=fartygID
if the data.opExist == "False" ?
//Here is the function that validate. check_generic is called asynchronously
function Validate(ctrlID, ipTable, ipKey, ipKeyValue)
{
var ipDescriptionField = "";
check_generic(ipTable, ipKey, ipDescriptionField, ipKeyValue,
function (data, textStatus, jqXHR)
{
IsOkMessageShort(data.dsError);
if (data.opExist == "False")
{
$("#fartygID").focus(); //Invalid value don't leave
fartygID
}
});
}
function TabOn_FartygInDialog(e)
{
var TABKEY = 9;
if (e.keyCode == TABKEY)
{
Validate("fartygID", "AFARTYG", "FARTNR", "",
$('#fartygID').val());
// this.value += " ";
// if (e.preventDefault)
// {
// e.preventDefault();
// }
// return false;
}
}
//Tony
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2013-05-24 22:14 +0000 |
| Message-ID | <knoood$qpi$3@dont-email.me> |
| In reply to | #19924 |
On Fri, 24 May 2013 16:43:43 +0200, Tony wrote: > $( jquery detected, please ask in a jquery forum. -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Christoph Becker <cmbecker69@gmx.de> |
|---|---|
| Date | 2013-05-25 00:51 +0200 |
| Message-ID | <knoqrf$j3f$1@speranza.aioe.org> |
| In reply to | #19947 |
Denis McMahon wrote: > On Fri, 24 May 2013 16:43:43 +0200, Tony wrote: > >> $( > > jquery detected, please ask in a jquery forum. How so? I am just detecting the beginning of a CallExpression with the MemberExpression being the identifier $. -- Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2013-05-25 00:09 +0100 |
| Message-ID | <timstreater-2661B9.00090425052013@news.individual.net> |
| In reply to | #19948 |
In article <knoqrf$j3f$1@speranza.aioe.org>, Christoph Becker <cmbecker69@gmx.de> wrote: > Denis McMahon wrote: > > On Fri, 24 May 2013 16:43:43 +0200, Tony wrote: > > > >> $( > > > > jquery detected, please ask in a jquery forum. > > How so? I am just detecting the beginning of a CallExpression with the > MemberExpression being the identifier $. He's using heuristics. -- Tim "That excessive bail ought not to be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web