I am utilizing the displayTag table decorator in order to showcase my JSP page.
The page features a table with various columns. One of these columns is labeled Action and contains 2 hyperlinks - pay and close. Every row will consist of 5 columns, with action being the last column that includes hyperlinks.
Here is the code snippet for displaying the action in JSP
<display-el:column property="action" sortable="false" title=" "
class="defaultTextCentered" style="width:6%" sortName="action" />
Below is the decorator code I am using
public String getAction() {
renderPayLink();
}
private void renderPayLink() {
decoratedVal.append("<a href=\"javascript:newPopup('");
decoratedVal.append(getContextPath());
decoratedVal.append("/abc/taxPaymentInternal.html?iSeqNo=");
decoratedVal.append(abc.getISeqNumber());
decoratedVal.append("&iPeriod=");
decoratedVal.append(abc.getIDate());
decoratedVal.append("', 800, 700)\" title=\"Pay\">Pay</a>");
decoratedVal.append(" ");
}
When clicking on the link, a popup window opens where the user enters information and submits it. However, if the pay button is clicked again before submitting the info, the popup refreshes, requiring the user to re-enter the details. To prevent this, I need to disable the pay button after clicking it and opening the popup. How can I achieve this?
Instead of pay, replacing it with
decoratedVal.append("', 800, 700)\" title=\"Pay\" ");
decoratedVal.append("onclick=\"this.setAttribute(");
decoratedVal.append("\'style\', \'pointer-events:none; cursor:default;\'); this.setAttribute(");
decoratedVal.append("\'href\', \'\')\">Pay</a>");
decoratedVal.append(" ");
An error stating "Unable to get property 'setAttribute' of undefined or null reference" appears when debugging using F12.
<a title="Pay" onclick="this.setAttribute('style', 'pointer-events:none; cursor:default;'); this.setAttribute('href', '')" href="javascript:newPopup('/mei/invoicing/launchConfirmPaymentInternal.html?invoiceSeqNo=131946&invoicePeriod=02-11-2017', 800, 700)">Pay</a>