Need help with a code issue sent through Private Messages.
2 posters
Page 1 of 1
Need help with a code issue sent through Private Messages.
Hey there,
I have a question that I will detail in this post. The post might be a little lengthy because I'm going to explain everything I've tried so far.
So what I'm trying to accomplish is to have a post available in a received private message, kind of like a quick reply box, or a normal post box. The purpose of this is to send a message (in the case of the PM a persons name) to a certain forum thread.
The steps I took, involved me using the quick reply code directly from the forum, this is the code I used:
That code was copied directly from the forum. Sending that via a PM gave me a type of result I wanted. It looked perfect in the PM, and I was able to put a message, however, when I would click send, it would open up the thread and say there was an error, and make me have to submit the message through that.
What I'm attempting to do is have it post directly from the PM without it having to redirect the member. So, I searched these forums to see if anyone else had a issue similar to mine, and I found one. I saw Ange Tuteur help another person with this issue, and I tried the code that she gave him, here is the code:
So I put that in the message, and everything worked perfectly, except it did not use this line
So when you pressed send, it gave an error and brought you to a different page and wouldn't let you post, unlike the very first error. So I decided to go about it differently. I put this in a HTML page and made it so it wouldn't use my forum header and footer. So it was just the blank page and the text box; which, by the way, worked perfectly on that page.
Seeing it worked like that, I decided to try a different route. I tried to use an iframe to display the message within a pm, so my overall code looked like:
This worked perfectly, it gave me the exact visual result I wanted, I'm not sure if I can post a full picture, so I'll post it in a spoiler so it doesn't disturb the topic:
However, it gave me the same issue I had initially from just copying the code from a quick reply box. It would submit the message, give an error and then bring me to an actual reply window to hit send there.
I'm stumped as to what to do next to get it to work, if it is even possible. Any help would be greatly appreciated.
Edit: My forum address is http://eriviyn.forumotion.com
I have a question that I will detail in this post. The post might be a little lengthy because I'm going to explain everything I've tried so far.
So what I'm trying to accomplish is to have a post available in a received private message, kind of like a quick reply box, or a normal post box. The purpose of this is to send a message (in the case of the PM a persons name) to a certain forum thread.
The steps I took, involved me using the quick reply code directly from the forum, this is the code I used:
- Code:
<form action="/post" method="post" name="post" id="quick_reply"><div id="textarea_content" style="width: 50%; clear: both; margin-left: auto; margin-right: auto; text-align: center;"><textarea id="text_editor_textarea" name="message"></textarea></div><div style="text-align:center; margin-top:20px;"><input type="hidden" name="attach_sig" value="1" /><input type="hidden" name="mode" value="reply" /><!-- <input type="hidden" name="sid" value="" /> --><input type="hidden" name="tid" value="bc5eb33b47750c241c5d6b364685a704" /><input type="hidden" name="t" value="110" /><input type="hidden" name="lt" value="255" /><input type="hidden" name="notify" value="1" /><script type="text/javascript">smilieoptions = {};</script><input type="submit" name="preview" class="button2" value="Preview" /> <input type="submit" name="post" class="button2" value="Send" /></div><input type="hidden" name="auth[]" value="fb1feb76c1f9bcb0fb5fd380495b01d0" /><input type="hidden" name="auth[]" value="a1f66ddee3eda9ef5d8537a7a17a3952" /></form>
That code was copied directly from the forum. Sending that via a PM gave me a type of result I wanted. It looked perfect in the PM, and I was able to put a message, however, when I would click send, it would open up the thread and say there was an error, and make me have to submit the message through that.
What I'm attempting to do is have it post directly from the PM without it having to redirect the member. So, I searched these forums to see if anyone else had a issue similar to mine, and I found one. I saw Ange Tuteur help another person with this issue, and I tried the code that she gave him, here is the code:
- Code:
<form enctype="multipart/form-data" name="post" method="post" action="/post">
<textarea id="text_editor_textarea" name="message"></textarea> <!-- Textarea -->
<div id="authData" style="display:none;"></div> <!-- Auth data for permissions -->
<script type="text/javascript">jQuery('#authData').load('/t110- input[name="auth[]"]');</script>
<input name="mode" value="reply" type="hidden"/> <!-- Post mode -->
<input name="t" value="110" type="hidden"/> <!-- Topic ID -->
<input class="button1" name="post" value="Send" tabindex="6" accesskey="s" type="submit"/> <!-- Submit button -->
</form>
So I put that in the message, and everything worked perfectly, except it did not use this line
- Code:
jQuery('#authData').load('/t110- input[name="auth[]"]');
So when you pressed send, it gave an error and brought you to a different page and wouldn't let you post, unlike the very first error. So I decided to go about it differently. I put this in a HTML page and made it so it wouldn't use my forum header and footer. So it was just the blank page and the text box; which, by the way, worked perfectly on that page.
Seeing it worked like that, I decided to try a different route. I tried to use an iframe to display the message within a pm, so my overall code looked like:
- Code:
<iframe style="width: 200px; height: 240px;" scrolling="no" frameborder="0" src="http://eriviyn.forumotion.com/h4-test"></iframe>
This worked perfectly, it gave me the exact visual result I wanted, I'm not sure if I can post a full picture, so I'll post it in a spoiler so it doesn't disturb the topic:
- Picture:
However, it gave me the same issue I had initially from just copying the code from a quick reply box. It would submit the message, give an error and then bring me to an actual reply window to hit send there.
I'm stumped as to what to do next to get it to work, if it is even possible. Any help would be greatly appreciated.
Edit: My forum address is http://eriviyn.forumotion.com
Re: Need help with a code issue sent through Private Messages.
Hello RazielBach,
Is this to sent a private message to the founder ?
Is this to sent a private message to the founder ?
Re: Need help with a code issue sent through Private Messages.
Nope, this is a private message that I (the founder) will be sending to every member on the forum at a certain time.
Re: Need help with a code issue sent through Private Messages.
Where does the form post, does it post to specific topic ? If so could you provide the link to that topic ?
Thanks.
Thanks.
Re: Need help with a code issue sent through Private Messages.
http://eriviyn.forumotion.com/t110-posts-go-here-for-character-names
That is where it is supposed to go. I have been moving that topic around a bit now since the codes I tried didn't work, although since it is topic based I don't think it matters what subsection it goes into matters.
Nonetheless, when I initially tried this code, it was never moved.
That is where it is supposed to go. I have been moving that topic around a bit now since the codes I tried didn't work, although since it is topic based I don't think it matters what subsection it goes into matters.
Nonetheless, when I initially tried this code, it was never moved.
Re: Need help with a code issue sent through Private Messages.
See how this works :
- Code:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<form enctype="multipart/form-data" name="post" method="post" action="/post">
<textarea id="text_editor_textarea" name="message"></textarea> <!-- Textarea -->
<div id="authData" style="display:none;"></div> <!-- Auth data for permissions -->
<script type="text/javascript">jQuery('#authData').load('/t110- input[name="auth[]"]');</script>
<input name="mode" value="reply" type="hidden"/> <!-- Post mode -->
<input name="t" value="110" type="hidden"/> <!-- Topic ID -->
<input class="button1" name="post" value="Send" tabindex="6" accesskey="s" type="submit"/> <!-- Submit button -->
</form>
Re: Need help with a code issue sent through Private Messages.
So I tried that two different ways
The first way was just copying and pasting the code right into a PM, which sent the box and the send message, but did not register the:
The second way I tried was by imbedding it, which worked perfectly and then redirected it to that page (as expected, since that happens after a post is made).
I have another question now, is it possible to set that up so it doesn't redirect, and when the form is submitted it posts to the topic and won't redirect the iframe?
The first way was just copying and pasting the code right into a PM, which sent the box and the send message, but did not register the:
- Code:
jQuery('#authData').load('/t110- input[name="auth[]"]')
The second way I tried was by imbedding it, which worked perfectly and then redirected it to that page (as expected, since that happens after a post is made).
I have another question now, is it possible to set that up so it doesn't redirect, and when the form is submitted it posts to the topic and won't redirect the iframe?
Re: Need help with a code issue sent through Private Messages.
Okay, try this :
Replace your HTML by :
Then go to Administration Panel > Modules > Javascript codes management > Create a new script
Title : Data check
Placement : In all the pages
Paste the code below :
sessionStorage.sentData is set when the form submits. If found the code above is executed. That means you'll be redirected to /h1- (first HTML page), replace this path with whatever you wish, even a new HTML page which displays success..
Replace your HTML by :
- Code:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<form enctype="multipart/form-data" name="post" method="post" action="/post" onsubmit="setData();">
<textarea id="text_editor_textarea" name="message"></textarea> <!-- Textarea -->
<div id="authData" style="display:none;"></div> <!-- Auth data for permissions -->
<script type="text/javascript">jQuery('#authData').load('/t110- input[name="auth[]"]');</script>
<input name="mode" value="reply" type="hidden"/> <!-- Post mode -->
<input name="t" value="110" type="hidden"/> <!-- Topic ID -->
<input class="button1" name="post" value="Send" tabindex="6" accesskey="s" type="submit"/> <!-- Submit button -->
</form>
<script type="text/javascript">function setData() { if (window.sessionStorage) sessionStorage.sentData = true }</script>
Then go to Administration Panel > Modules > Javascript codes management > Create a new script
Title : Data check
Placement : In all the pages
Paste the code below :
- Code:
if (sessionStorage.sentData) {
location.pathname = '/h1-';
sessionStorage.removeItem('sentData');
}
sessionStorage.sentData is set when the form submits. If found the code above is executed. That means you'll be redirected to /h1- (first HTML page), replace this path with whatever you wish, even a new HTML page which displays success..
Re: Need help with a code issue sent through Private Messages.
After the post is submitted, it pops up with You Can Return To The Index. I'm assuming with an iframe, this is good as I'm going to get. I don't believe (though I may be wrong) that the iframe can bring the main browser window to a certain page.
I assume it'd work if the PM registered the
without the imbed.
So I would say this is solved, unless you know of a way to make it so an imbedded page can bring the page it's imbedded to back to a different page. (worded kind of weird, sorry)
I assume it'd work if the PM registered the
- Code:
jQuery('#authData').load('/t110- input[name="auth[]"]');
without the imbed.
So I would say this is solved, unless you know of a way to make it so an imbedded page can bring the page it's imbedded to back to a different page. (worded kind of weird, sorry)
Re: Need help with a code issue sent through Private Messages.
Unfortunately the frame can only modify its location. It cannot modify the window it is in. It's like another window/tab if that makes sense.
You could make location.pathname = '/h1-'; be location.pathname = '/forum'; which returns the iframe to the forum. You could also create another HTML page with success texts and set its path as the redirect.
You could make location.pathname = '/h1-'; be location.pathname = '/forum'; which returns the iframe to the forum. You could also create another HTML page with success texts and set its path as the redirect.
Re: Need help with a code issue sent through Private Messages.
Yeah, it makes sense. And yep, I had the "/h1-" redirect it back to the forum, but like I said, it's the iframe. However, it seems like this is as good as it'll get.
Thank you for the help! This is solved now.
Thank you for the help! This is solved now.
Re: Need help with a code issue sent through Private Messages.
You're welcome ^^
Topic archived
Have a great day.
Topic archived
Have a great day.
Similar topics
» Private messages shows you have no new messages
» About Private Messages
» Private Messages
» Private messages
» POP UP private messages
» About Private Messages
» Private Messages
» Private messages
» POP UP private messages
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum