Attention:

Support Rules and Guidelines
Before you post your support topic, please remember to:
  • Read the support forum rules.
  • Check the wiki and use search to see if your problem can be answered there first.
  • Link your board please, and make sure that the problem on your board is visible to guests or provide a test account.
  • Do not post Board Wrappers and CSS unless requested. With a board link, this is not necessary.
  • Be as descriptive as you can and use as many details as possible when describing your problem.
  • Please briefly mark any links to forums that may not be work-safe.
This will help ensure your support issue will be attended to in a quick and efficient manner.

  ClosedNew TopicNew Poll

 autosave sent PMs doesn't work in mobile [SOLVED]
#
Hi there,

I found this post on the support forums from a while ago with some helpful code in it so that the 'save a copy of this PM' box is always checked when you compose a new message.

http://forums.jcink.com/index.php?showtopic=18320

It appears to be working in desktop mode, but PMs sent from my phone/using the mobile mode are not being saved! Does anybody know of a fix for this?

roaringdandelion.jcink.net

This post has been edited by thenoisyflower: May 10 2018, 09:54 AM
PM
#
That's because mobile mode changes the URL, which that script is dependent on. With respect to John and the time that script was written, you can do this a number of more succinct ways nowadays, with the introduction of querySelector:

For several checkboxes
CODE
var li = document.querySelectorAll('input[name=add_sent], input[name=add_tracking]')
for(i=0;i<li.length;i++)
 {li[i].checked=true}

you could also skip the for loop and just jump straight to li.item(0) and li.item(1), which would look like:

CODE
var li = document.querySelectorAll('input[name=add_sent], input[name=add_tracking]')
li[0].checked=true
li[1].checked=true


For one checkbox
CODE
document.querySelectorAll('input[name=add_sent]')[0].checked=true


This post has been edited by Dusty: May 13 2018, 06:28 PM
PM
#
QUOTE (Dusty @ May 10 2018, 01:30 PM)
That's because mobile mode changes the URL, which that script is dependent on. With respect to John and the time that script was written, you can do this a number of more succinct ways nowadays


You could do it better even back then, I'm pretty sure I just googled for that one and copied it from a post previously. Thanks for the shorter code. http://files.b1.jcink.com/html/emoticons/smile.gif

signature
email: admin@jcink.com :: blog: John C.
#
Thank you so much! Does this go in the Style Sheet, or the HTML templates?
PM
#
Neither! Wrap it in script tags and throw it in your wrappers near the </body> tag.
PM
#
Inside it, or just after? I tried all of them, but they don't seem to be working. Hmmm....

This post has been edited by thenoisyflower: May 26 2018, 04:08 PM
PM
#
Just inside the closing body tag. Open your web console (usually F12) and check the console tab for errors. It may just be that it needs to wait for a state change.
PM
#
Silly question...I assume I have to have code in place that would make the checkboxes appear in mobile mode at all in order for this to work? Also code that would allow you to access sent mail in mobile mode?

If not, I'm stumped. None of the error messages were related to this - the console tab only showed errors related to insecure font scripts.
PM
#
Oh dear, I completely forgot that those inputs don't appear in mobile mode. Luckily, all they do is append an extra parameter to POST, so that'll be a reasonably simple fix, if a bit.. weird.

On a plus note, recently found out JQuery is loaded in mobile mode still. <3
CODE
$(function() {
 if ($('#mobile') && ($('input[name="CODE"]').val() === '04')) {
   $('<input name="add_sent" value="yes" type="checkbox"><b>Add a copy of this message to my sent items folder</b><br><input name="add_tracking" value="1" type="checkbox"><b>Track this message?</b>').insertAfter($('.textinput + div'))
 }
})


You can use that to append the checkboxes to the mobile messenger. By default, they're unchecked, though you can add the boolean attribute inside the input and they'll then default to checked - otherwise, you'll need to follow it with the script from before.
PM
#
So, just to make sure I've got it right, just inside the closing body tag on my board wrappers, I should have either:

<script>
$(function() {
if ($('#mobile') && ($('input[name="CODE"]').val() === '04')) {
$('<input name="add_sent" value="yes" type="checkbox"><b>Add a copy of this message to my sent items folder</b><br><input name="add_tracking" value="1" type="checkbox"><b>Track this message?</b>').insertAfter($('.textinput + div'))
}
})

var li = document.querySelectorAll('input[name=add_sent], input[name=add_tracking]')
li[0].checked=true
li[1].checked=true
</script>

OR

<script>
$(function() {
if ($('#mobile') && ($('input[name="CODE"]').val() === '04')) {
$('<input name="add_sent" value="yes" type="checkbox"><b>Add a copy of this message to my sent items folder</b><br><input name="add_tracking" value="1" type="checkbox"><b>Track this message?</b>').insertAfter($('.textinput + div'))
}
})

var li = document.querySelectorAll('input[name=add_sent], input[name=add_tracking]')
for(i=0;i<li.length;i++)
{li[i].checked=true}
</script>

I'm wondering if I did something wrong, as neither of those appears to make a change in mobile mode.

Thanks for your patience on this one.
PM
#
Ok, so the mobile template can be a little complicated to insert JavaScript. Not only that, I checked the post form and the tracked nor sent options were even hidden fields. When I wrote the mobile mode system I just didn’t include them. I have now added them AND storing sent PMs on mobile is default checked, so no one has to use js on mobile to enable it and can avoid the struggle you've been having here thenoisyflower

Attached 1 File(s)
Attached Image

signature
email: admin@jcink.com :: blog: John C.
#
You're a marvel, John. Thank you SO much for everything you do!
PM
#
This topic has been solved. If you need anymore help please post a new thread. Thanks for choosing Jcink services.

signature
email: admin@jcink.com :: blog: John C.
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Share this topic:
« Next Oldest | General Support | Next Newest »

Options ClosedNew TopicNew Poll