|
566 | 566 | var elemSelector = '#recordValues\\.' + recordIdx + '\\.recordedByID';
|
567 | 567 | $(elemSelector).val(item.key).attr('collector_name', item.name);;
|
568 | 568 | }
|
| 569 | + } else if (fieldName == 'occurrenceDetails') { |
| 570 | + var matches = $(this).attr("id").match(/^recordValues[.](\d+)[.]occurrenceDetails$/); |
| 571 | + if (matches.length > 0) { |
| 572 | + var recordIdx = matches[1]; |
| 573 | + var elemSelector = '#recordValues\\.' + recordIdx + '\\.occurrenceID'; |
| 574 | + $(elemSelector).val(item.key).attr('collector_name', item.name);; |
| 575 | + } |
| 576 | + } else if (fieldName == 'verbatimLocality') { |
| 577 | + var matches = $(this).attr("id").match(/^recordValues[.](\d+)[.]verbatimLocality$/); |
| 578 | + if (matches.length > 0) { |
| 579 | + var recordIdx = matches[1]; |
| 580 | + var elemSelector = '#recordValues\\.' + recordIdx + '\\.verbatimLocalityID'; |
| 581 | + $(elemSelector).val(item.key).attr('collector_name', item.name);; |
| 582 | + } |
569 | 583 | }
|
570 | 584 | },
|
571 | 585 | source: function(request, response) {
|
|
617 | 631 | }
|
618 | 632 | });
|
619 | 633 |
|
| 634 | + $("input.occurrenceDetails").blur(function(e) { |
| 635 | + // If the value of the occurrenceDetails field does not match the name in the collector_name attribute |
| 636 | + // of the occurrenceID element it means that the collector name no longer matches the id, so the id |
| 637 | + // must be cleared. |
| 638 | + var matches = $(this).attr("id").match(/^recordValues[.](\d+)[.]occurrenceDetail$/); |
| 639 | + var value = $(this).val(); |
| 640 | + if (matches.length > 0) { |
| 641 | + var recordIdx = matches[1]; |
| 642 | + var elemSelector = '#recordValues\\.' + recordIdx + '\\.occurrenceID'; |
| 643 | + var collectorName = $(elemSelector).attr("collector_name"); |
| 644 | + if (value != collectorName) { |
| 645 | + $(elemSelector).val(''); |
| 646 | + $(elemSelector).attr("collector_name", ""); |
| 647 | + } |
| 648 | + } |
| 649 | + }); |
| 650 | + |
| 651 | + $("input.verbatimLocality").blur(function(e) { |
| 652 | + // If the value of the verbatimLocality field does not match the name in the collector_name attribute |
| 653 | + // of the verbatimLocalityID element it means that the collector name no longer matches the id, so the id |
| 654 | + // must be cleared. |
| 655 | + var matches = $(this).attr("id").match(/^recordValues[.](\d+)[.]verbatimLocality$/); |
| 656 | + var value = $(this).val(); |
| 657 | + if (matches.length > 0) { |
| 658 | + var recordIdx = matches[1]; |
| 659 | + var elemSelector = '#recordValues\\.' + recordIdx + '\\.verbatimLocalityID'; |
| 660 | + var collectorName = $(elemSelector).attr("collector_name"); |
| 661 | + if (value != collectorName) { |
| 662 | + $(elemSelector).val(''); |
| 663 | + $(elemSelector).attr("collector_name", ""); |
| 664 | + } |
| 665 | + } |
| 666 | + }); |
| 667 | + |
620 | 668 | }
|
621 | 669 |
|
622 | 670 | function disableSection(classSelector) {
|
|
0 commit comments