Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function tab_chain("IBAN1", ["IBAN2", "IBAN3"]) {
- // Move to next field if the current keystroke
- // fills the field. Move to the previous field
- // if the current keystroke empties the field.
- // Pasted data that is too long for the current
- // will be continued into the fields listed in
- // the next_fields array.
- var rest, prev, next, i;
- event.change = event.change.toUpperCase();
- rest = event.changeEx.toUpperCase();
- var merged = AFMergeChange(event);
- //console.println("Name: '" + event.target.name + "'");
- //console.println("Merged: '" + merged + "'");
- if (merged.length === event.target.charLimit) {
- //console.println("Limit: " + event.target.charLimit);
- i = 0;
- prev = event.target;
- next = getField(["IBAN2", "IBAN3"]);
- rest = rest.substr(event.change.length);
- while (next !== null && rest.length > 0) {
- //console.println("Rest: " + rest);
- merged = rest.substr(0, next.charLimit);
- rest = rest.substr(merged.length);
- next.value = merged;
- prev = next;
- next = getField(["IBAN2", "IBAN3"]);
- }
- // Update focus if previous pasted field is full.
- if (next !== null && merged.length === prev.charLimit) {
- next.setFocus();
- }
- }
- else if (merged.length === 0) {
- getField("IBAN1").setFocus();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement