![]() |
Javascript confirmation box
I am trying to use the following script to create a Confirmation Popup box for my "Mark All Forums Read" link, but it isn't working.
In my Navbar template I placed the following at the top: Code:
<vb:literal> I changed the link for "Mark All Forums Read" to: Code:
<a href="javascript:markAsRead();"><b><font color=red>{vb:rawphrase mark_forums_read}</font></b></a> I end up getting the following error in my browser when trying to follow the link: Quote:
I noticed when the page changes, the URL shows up as: http://www.mysite.com/forumdisplay.php?{vb:raw session.sessionurl}do=markread&markreadhash={vb:ra w bbuserinfo.securitytoken} It looks like the hash and security tokens are not being passed in the Java Script as they were in vB3. I was able to use the following in vB3.8.5 and it works fine, but it isn't working in vB4.x: Code:
<script> Code:
<a href="javascript:markAsRead();">$vbphrase[mark_forums_read]</a> Any help would be greatly appreciated! . |
* Bump *
|
Try adding the javascript to the headinclude or header template.
|
The problem is you wrapped the javascript around <vb: literal> tags, which you should do, but that means none of the {vb: raw } tags are being parsed in the script.
Maybe try passing this data through the function? Code:
<a href="javascript:markAsRead({vb:raw session.sessionurl},{vb:raw bbuserinfo.securitytoken );">{vb:rawphrase mark_forums_read}</a> Code:
<vb:literal> |
Quote:
Quote:
I think we are getting closer as it makes sense that the vb:literal tags are causing the noparse. |
What's the syntax error? I see already that I missed a ")"
so, Code:
<a href="javascript:markAsRead({vb:raw session.sessionurl},{vb:raw bbuserinfo.securitytoken});">{vb:rawphrase mark_forums_read}</a> |
Quote:
It doesn't tell me what the Syntax Error is. When I hover over the link, it shows: javascript:markAsRead(,1279577127-xxxxxxxxxxxxxxxxxxx) It appears there might be a hash missing. Also, when I click on the Mark All Read button, I don't get the confirmation popup either. |
Try:
Code:
<a href="javascript:markAsRead('{vb:raw session.sessionurl}','{vb:raw bbuserinfo.securitytoken}');">{vb:rawphrase mark_forums_read}</a> |
Quote:
That appears to have done the trick! THANK YOU for your help!!! :up::up::up::up::up::up::up::):):):):) |
Where did you end up putting the js code?
|
All times are GMT. The time now is 09:11 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|