Ask Question Forum:
Model Library:2025-02-08 Updated:A.I. model is online for auto reply question page
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by livegirllove
at 2024-07-27 03:27:42
Point:500 Replies:11 POST_ID:829128USER_ID:12021
Topic:
JavaScript;;
i have a form with some required fields. If the field is blank the pages pops up a warning. It works fine on "normal" fields.
if(document.send_request.city.value==''){ alert('Please enter city'); document.send_request.city.focus(); return false; 1:2:3:4:
On some fields I have an autotab function.
<"script language="javascript" type="text/javascript">" for(var l=0;" l<"=2;" l++){ var l1=l+1;" document.write('<"input name="cvv_'+l+'" type="text" class="middletextfield" id="cvv_'+l+'" style="width:10px;"" maxlength="1" onKeyup="autotab(this, document.send_request.cvv_'+l1+')"/>"');" }/*send_request*/ <"/script>" 1:2:3:4:5:6:
my problem is the error checking doesnt work for fields that have the autotab.
What am I doing wrong?
What does this line actually do
Author: livegirllove replied at 2024-07-27 06:03:54
you are correct its wrong. but the point was I need cvv_0 etc.
Expert: Ray Paseur replied at 2024-07-27 06:00:48
For the record in the accepted solution, is this line correct?
document.send_request.city.focus();
It would appear that the JavaScript is testing the cvv values, but if they're empty it will set focus on the city element?
document.send_request.city.focus();
It would appear that the JavaScript is testing the cvv values, but if they're empty it will set focus on the city element?
Author: livegirllove replied at 2024-07-27 05:24:35
that works perfect thanks
Accepted Solution
Expert: duncanb7 replied at 2024-07-27 05:20:13
500 points EXCELLENT
Is it what you want for check() ? other check for input is similar
if(document.send_request.cvv_0.value==''){ alert('Please enter cvv'); document.send_request.city.focus(); return false;}if(document.send_request.cvv_1.value==''){ alert('Please enter cvv'); document.send_request.city.focus(); return false;}if(document.send_request.cvv_2.value==''){ alert('Please enter cvv'); document.send_request.city.focus(); return false;} 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:
Author: livegirllove replied at 2024-07-27 05:07:00
the auto tab works. If you enter nothing in the cvv box it should popup a warning message. It does not popup the message and allows the form to submit.
If you don't enter phone number the warning works correctly.
auto tab works. error checking does not but only on fields that use autotab. credit card and cvv
If you don't enter phone number the warning works correctly.
auto tab works. error checking does not but only on fields that use autotab. credit card and cvv
Expert: duncanb7 replied at 2024-07-27 05:02:29
I run your page that is working, I type 1 at box 1on cvv, it will go and focus to next box, so on
the autotab function is okay no error.
Where is error area you are talking ? I don't find any error and review your question post that
is not mentioned.
You need to write it in detail ,otherwise confusing
Duncan
the autotab function is okay no error.
Where is error area you are talking ? I don't find any error and review your question post that
is not mentioned.
You need to write it in detail ,otherwise confusing
Duncan
Author: livegirllove replied at 2024-07-27 04:33:51
I attached the file. The autotabs are inline in the form.
The error check is in the header and does the check on submit and pops up a warning message. I don't want to rewrite this ancient terrible code I just need to know what variable I should have document.send_request.cvv.value?
document.send_request.cvv+ll+.value
document.send_request.cvv_.value
document.send_request.cvv+i+.value
thanks
The error check is in the header and does the check on submit and pops up a warning message. I don't want to rewrite this ancient terrible code I just need to know what variable I should have document.send_request.cvv.value?
document.send_request.cvv+ll+.value
document.send_request.cvv_.value
document.send_request.cvv+i+.value
thanks
Expert: duncanb7 replied at 2024-07-27 04:25:16
try review my previous post and try my example code , and you will know it,
where is your autotab funnction?
where is your autotab funnction?
Author: livegirllove replied at 2024-07-27 04:23:38
if(document.send_request.cvv.value==''){ alert('Please enter cvv); document.send_request.cvv.focus(); return false; 1:2:3:4:
this doesn't work.
what variable is it seeing. When I post the form the variable is $cvv but the javascript doesn't seem to be seeing that.
Expert: duncanb7 replied at 2024-07-27 04:17:29
You need to set name attribute in the form, take a look as following code and its autotab function. I put javascript code for input tag between form tag, and variable "ll+1" is for the variable in autotab() function so that you keyup on first input tab and the next input tab
will be focus , so it is ll+1; 1 means next input tag
Try input something in input box 1 and keyup and then you will see next input box will be focused that is function of autotab
You can use browser developer tools click options->developer tolls->console, or Element, you can see all final code and its error.
Duncan
will be focus , so it is ll+1; 1 means next input tag
Try input something in input box 1 and keyup and then you will see next input box will be focused that is function of autotab
You can use browser developer tools click options->developer tolls->console, or Element, you can see all final code and its error.
Duncan
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>AutoTab Javascript</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><script type="text/javascript">function autotab(current,to){if (current.getAttribute && current.value.length==current.getAttribute("maxlength")) { to.focus()}}</script> <body style="width:1000px; height:1000px"> <form name="send_request"> <textarea> This is testing </textarea> <script type="text/javascript"> for(var l=0; l<=2; l++){ var l1=l+1; document.write('<input name="cvv_'+l+'" type="text" class="middletextfield" id="cvv_'+l+'" style="width:10px;" maxlength="1" onKeyup="autotab(this, document.send_request.cvv_'+l1+')"/>'); }/*send_request*/ </script> </form> </body></html> 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22:23:24:25:26:27:
Expert: Ray Paseur replied at 2024-07-27 04:10:03
One thing it does is produce a visually confusing line of code! I wish people would understand that so many errors and annoyances and timewasters can be avoided if you just omit the visually ambiguous letters and numbers from your variable names*. The list is pretty simple: O (oh), 0 (zero) I (eye), 1 (one), l (ell). In some fonts, 5 (five), S (ess). In some fonts, 2 (two), Z (zee).
Taken by itself, the line of code uses the current value of l (ell) and adds one to it. Then it assigns the resulting value to l1 (ell, one). All by itself this is not too dramatic, but if you look at the line before it, you will see that it is a for() loop iterator that initially sets l (ell) to zero. So this l1 (ell, one) variable is a pointer that looks ahead of the current value of the iterator.
* Omit these letters from your passwords, too. Especially the auto-generated passwords. And omit them from CAPTCHA images. They're more trouble than they're worth!
Taken by itself, the line of code uses the current value of l (ell) and adds one to it. Then it assigns the resulting value to l1 (ell, one). All by itself this is not too dramatic, but if you look at the line before it, you will see that it is a for() loop iterator that initially sets l (ell) to zero. So this l1 (ell, one) variable is a pointer that looks ahead of the current value of the iterator.
* Omit these letters from your passwords, too. Especially the auto-generated passwords. And omit them from CAPTCHA images. They're more trouble than they're worth!