[Prevent Spam Clicks] "__doPostBack is not defined" encountered for link

[Prevent Spam Clicks] "__doPostBack is not defined" encountered for link

  
Forge Component
(6)
Published on 31 Jan by João Pedro Abreu
6 votes
Published on 31 Jan by João Pedro Abreu

Hi,

I applied the prevent spam click on link. When I click on the link, the following error is encountered. Please advise.

Using java stack.


Uncaught ReferenceError: __doPostBack is not defined at Object.widgetObj.onclick (Home.jsf?_ts=636531839947259444:289

at HTMLAnchorElement.<anonymous> (Home.jsf?_ts=636531839947259444:313

at HTMLAnchorElement.dispatch (_osjs.js?10_0_705_0:19

at HTMLAnchorElement.h (_osjs.js?10_0_705_0:19)

Apparently the Java stack's link widget has a different behavior than the .NET stack's link widget. There's probably an easy solution for this, but I don't have access to a Java stack OutSystems server to debug the issue.

João Pedro Abreu wrote:

Apparently the Java stack's link widget has a different behavior than the .NET stack's link widget. There's probably an easy solution for this, but I don't have access to a Java stack OutSystems server to debug the issue.


Hi,

Please advise on the possible solution came across your mind. Thank you.

On the .NET stack a link with OnClick method of "Submit" invokes a platform javascript function called __doPostBack.

On the Java stack I imagine the javascript function has another name. In order for this component to work for links on Java, it needs to have some code added to use the correct function name. If you can send me a screenshot of the HTML for that link I may be able to figure out what I need to change.

João Pedro Abreu wrote:

On the .NET stack a link with OnClick method of "Submit" invokes a platform javascript function called __doPostBack.

On the Java stack I imagine the javascript function has another name. In order for this component to work for links on Java, it needs to have some code added to use the correct function name. If you can send me a screenshot of the HTML for that link I may be able to figure out what I need to change.


Hi,


My href generated is different. Is .NET the same?


link with no validation:

<a id="RichWidgets_wt2:wtMainContent:wtOkLink" href="javascript:void(0)" tabindex="8">ok_link</a>


link with with client and server validation:

<a id="RichWidgets_wt2:wtMainContent:wt19" onclick="OsPage_ClientValidate('RichWidgets_wt2:wtMainContent:wt19');" href="javascript:{if (OsPage_ClientValidate('RichWidgets_wt2:wtMainContent:wt19')) if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('WebForm1'),{'RichWidgets_wt2:wtMainContent:wt19':'RichWidgets_wt2:wtMainContent:wt19'},'');}}" tabindex="11">linkWithClientAndserverValidation</a>

 

link with server validation:

<a id="RichWidgets_wt2:wtMainContent:wt15" href="javascript:{if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('WebForm1'),{'RichWidgets_wt2:wtMainContent:wt15':'RichWidgets_wt2:wtMainContent:wt15'},'');}}" tabindex="12">linkwithServerValidation</a>


Clearly submit links work differently on the java stack. I can't fix the component just based on the information I currently have, so I suggest you try to write your own JavaScript to solve this issue, or use only server side validations to prevent multiple submits in this situation.

Sorry I couldn't be of more help.