vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Redirected to inlinemod.php (https://vborg.vbsupport.ru/showthread.php?t=282971)

Spit-wad 05-15-2012 07:03 PM

Redirected to inlinemod.php
 
Moderators are being redirected to inlinemod.php when clicking on new bbcodes I have created.

It works perfectly for users who are not able to edit the thread or are not logged in, but moderators are instead redirected where a message is returned "Invalid Action Specified"

Here is the BBCODE:

<div style="margin: 5px;">
<div class="vod" style="margin-bottom: 2px;">
<input type="image" src="[redacted]"
onmouseover="this.src = '[redacted]';"
onmouseout="this.src = '[redacted]';"
onclick="if(this.parentNode.parentNode.getElements ByTagName('div')[1].getElementsByTagName('div')[0].style.display != 'inline')
{ this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = 'inline'; this.innerText = ''; this.value = 'Hide'; }
else { this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value='Show'; }" type="button"> </div>
<div class="alt2" style="padding: 0px;">
<div class="spoiler" style="display: none;">{param}</div> </div></div>

The function is the same as a normal spoiler tag, which works fine:

<div style="margin: 5px;">
<div class="smallfont" style="margin-bottom: 2px;">
<b>Spoiler</b> <input value="Show" style="margin: 0px; padding: 0px; width: 45px; font-size: 10px;" onclick="if(this.parentNode.parentNode.getElements ByTagName('div')[1].getElementsByTagName('div')[0].style.display != 'inline')
{ this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = 'inline'; this.innerText = ''; this.value = 'Hide'; }
else
{ this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value='Show'; }" type="button">
</div>
<div class="alt2" style="border: 1px inset; padding: 6px;">
<div class="spoiler" style="display: none;">{param}</div>
</div>
</div>

All I have done is tried to improve the aesthetics by using an image and a hover image. Any ideas why moderators are being redirected? How can I fix it?

kh99 05-15-2012 07:40 PM

The problem is that for moderators, all the posts are inside a form (so that the checkboxes work), and you've added an <input type="image"> which has a default action of submitting the form (the original code just has <input>). You can get around that by adding "return false;" to the very end of your onClick code.

Spit-wad 05-15-2012 07:51 PM

Sorry, but where exactly does the "return false;" go?

kh99 05-15-2012 08:00 PM

The line that ends in
Code:

this.value='Show'; }"

change to
Code:

this.value='Show'; } return false; "

Spit-wad 05-15-2012 08:05 PM

Ok, I made that change, but it did not seem to fix the problem.
Here is what I've got now:

Code:

<div style="margin: 5px;">
<div class="vod" style="margin-bottom: 2px;">
<input type="image" src="[redacted]"
onmouseover="this.src = '[redacted]';"
onmouseout="this.src = '[redacted]';"
onclick="if(this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != 'inline' )
{ this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'inline'; this.innerText = ''; this.value = 'Hide'; }
else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value='Show'; } return false;" type="button" > </div>
<div class="alt2" style="padding: 0px;">
<div class="spoiler" style="display: none;">{param}</div> </div></div>


kh99 05-15-2012 08:22 PM

Hmm...I tried what you posted and it works for me, and if I remove the "return false" it goes to "Invalid Action". Maybe it's a browser thing? What are you using?

Spit-wad 05-15-2012 08:28 PM

Ah, you might be right.

It is not working on Chrome, but your fix does work on Firefox.

My old version did not work on either, though.

Any ideas for how to get it working on Chrome?

kh99 05-15-2012 08:48 PM

Yes, it seems returning "false" doesn't stop the form from being submitted in some browsers. Here's a link to where someone asked about this: http://stackoverflow.com/questions/2...mically-to-the


But, I think maybe the solution is to just make the tag <img instead of <input type="image"

Spit-wad 05-15-2012 09:39 PM

Aha! It works with <img

Thanks for your help!


All times are GMT. The time now is 09:50 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
  • Page Generation 0.01766 seconds
  • Memory Usage 1,730KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete