Difference between revisions of "XML Javascript Function"
From SmartWiki
Mark Bridger (talk | contribs) |
|||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
| + | <table class="wikitable"> | ||
| + | <tr> | ||
| + | <td style="padding: 10px;"><big>This page has been deprecated</big></td> | ||
| + | <td style="padding: 10px;">See [[Custom Field Type: Special - XML Data]]</td> | ||
| + | </tr> | ||
| + | </table> | ||
| + | |||
XML Javascript Function is a section on [[Custom Field Type: Special - XML_Data|Special - XML Data]] type field. | XML Javascript Function is a section on [[Custom Field Type: Special - XML_Data|Special - XML Data]] type field. | ||
| Line 5: | Line 12: | ||
Example: | Example: | ||
| − | If the sum of cells with a specific css class (cellToTotal) (as defined in [[XML_Section_Builder]]) has to be alerted: | + | If the sum of cells with a specific css class (cellToTotal) (as defined in [[XML_Section_Builder|XML Section Builder]]) has to be alerted: |
<pre style="white-space: pre-wrap; | <pre style="white-space: pre-wrap; | ||
white-space: -moz-pre-wrap; | white-space: -moz-pre-wrap; | ||
| Line 18: | Line 25: | ||
</pre> | </pre> | ||
| − | + | Limit rows for Dynamic Section:<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">var saveFunc=saveXML; | |
| − | == | + | saveXML=function() { |
| − | + | saveFunc(); | |
| − | + | checkrows(); | |
| − | + | } | |
| + | function checkrows() { | ||
| + | var numOfRows = document.getElementsByName('6909_item_Funder'); //section node | ||
| + | if (numOfRows.length >5){ | ||
| + | alert("Please enter details for only 5 Largest Confirmed grants."); | ||
| + | } | ||
| + | }</pre> | ||
Latest revision as of 16:31, 19 December 2016
| This page has been deprecated | See Custom Field Type: Special - XML Data |
XML Javascript Function is a section on Special - XML Data type field.
Javascript and jQuery scripts can be added, which will run when the Special - XML Data field's open button is clicked, and the new window with the XML is opened.
Example:
If the sum of cells with a specific css class (cellToTotal) (as defined in XML Section Builder) has to be alerted:
var specCellSum=0;
$(".cellToTotal").each(function(){
specCellSum+=parseFloat($(this));
});
alert(specCellSum);
Limit rows for Dynamic Section:var saveFunc=saveXML;
saveXML=function() {
saveFunc();
checkrows();
}
function checkrows() {
var numOfRows = document.getElementsByName('6909_item_Funder'); //section node
if (numOfRows.length >5){
alert("Please enter details for only 5 Largest Confirmed grants.");
}
}