PDA

View Full Version : Redirected to inlinemod.php


Spit-wad
05-15-2012, 08:03 PM
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.getElementsByTagName ('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.getElementsByTagName ('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, 08: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, 08:51 PM
Sorry, but where exactly does the "return false;" go?

kh99
05-15-2012, 09:00 PM
The line that ends in
this.value='Show'; }"


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

Spit-wad
05-15-2012, 09:05 PM
Ok, I made that change, but it did not seem to fix the problem.
Here is what I've got now:


<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('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'; } 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, 09: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, 09: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, 09: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/2740112/return-false-is-ignored-in-certain-browsers-for-link-added-dynamically-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, 10:39 PM
Aha! It works with <img

Thanks for your help!