Advertisement
Guest User

Untitled

a guest
Nov 20th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. function tab_chain("IBAN1", ["IBAN2", "IBAN3"]) {
  2. // Move to next field if the current keystroke
  3. // fills the field. Move to the previous field
  4. // if the current keystroke empties the field.
  5.  
  6. // Pasted data that is too long for the current
  7. // will be continued into the fields listed in
  8. // the next_fields array.
  9.  
  10. var rest, prev, next, i;
  11. event.change = event.change.toUpperCase();
  12. rest = event.changeEx.toUpperCase();
  13. var merged = AFMergeChange(event);
  14. //console.println("Name: '" + event.target.name + "'");
  15. //console.println("Merged: '" + merged + "'");
  16.  
  17. if (merged.length === event.target.charLimit) {
  18. //console.println("Limit: " + event.target.charLimit);
  19. i = 0;
  20. prev = event.target;
  21. next = getField(["IBAN2", "IBAN3"]);
  22. rest = rest.substr(event.change.length);
  23. while (next !== null && rest.length > 0) {
  24. //console.println("Rest: " + rest);
  25. merged = rest.substr(0, next.charLimit);
  26. rest = rest.substr(merged.length);
  27. next.value = merged;
  28. prev = next;
  29. next = getField(["IBAN2", "IBAN3"]);
  30. }
  31. // Update focus if previous pasted field is full.
  32. if (next !== null && merged.length === prev.charLimit) {
  33. next.setFocus();
  34. }
  35. }
  36. else if (merged.length === 0) {
  37. getField("IBAN1").setFocus();
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement