145
Views
5
Comments
[Prevent Spam Clicks] "__doPostBack is not defined" encountered for link
Question
prevent-spam-clicks
Web icon
Forge asset 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)

2019-09-17 09-11-00
João Pedro Abreu
Staff

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.

UserImage.jpg
Chui Eng Ang

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.

2019-09-17 09-11-00
João Pedro Abreu
Staff

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.

UserImage.jpg
Chui Eng Ang

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>


2019-09-17 09-11-00
João Pedro Abreu
Staff

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.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.