An Auto Selection Puzzler

19 posts by 2 authors in: Forums > CMS Builder
Last Post: July 18, 2014   (RSS)

By gkornbluth - June 11, 2014

Hi Claire,

Sorry I incorporated your latest suggestion into the http://www.ericaminer.com/emaillistA.php code but I'm still having trouble with this.

The result is similar, except that the <br> between the first 2 emails is now deleted completely.

IE: xxxx@gmail.comyyyy@gmail.com<br>zzzz@gmail.com<br>aaaa@gmail.com<br> etc.

But it's still not one email address per line.

I've been pasting the results into notepad to check the results, and also pasting them into PHPList, the mailing program to see what will happen.

If I manually paste emails into notepad (or another word processor like WordPerfect), 1 per line as a test, and then copy and paste them into PHPList, they work perfectly.

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By claire - June 13, 2014

Hi Jerry

I've looked into this some more and I believe the newline character is being removed simply because the prompt field is a single line entry. It'll have to be a textarea to maintain the line breaks.

You need jQuery or another similar library to do this. If you email me FTP details, I'll add it to that page and see if I can get this working for you.

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By gkornbluth - July 12, 2014 - edited: July 12, 2014

Hi Claire,

Sorry to revisit this but I've been out of the office for about a month.

Using the global /g I managed to get all of the <br> to be removed, but they are not being replaced by anything, which when I paste the clipboard, renders one line of email addresses with no line breaks and no space between addresses.

You can see the result at http://ericaminer.com/emaillistB.php Log in with the Cookbook credentials that I sent you.

Here's the code I'm using (just in case I made a mistake somewhere)

<script>
function copylist(id)
{
    var divcontents = document.getElementById('list'+id);
    var text = divcontents.innerHTML;
var finaltext = text.replace(/<br>/g,"\n");
    window.prompt("Copy to Clipboard: CMD (CTL) +C To Copy - Press OK", finaltext);
}
</script>

And where I call the function:

 <div  align="left" class="copyright">
                      <button style="background:#7f0000" onclick="copylist(1)">Click To Select This List - CMD (CTL) +C To Copy - Press OK</button>
                      <br />
                      <div id="list1"><?php foreach ($email_signupRecords as $record): ?><?php if (($record['email'] && $record['hidden'] == 0 && $record['confirmed'] == 1) && ($record['remove']== 0 || $record['remove']== "")): ?><?php echo ($record['email']) ?><br><?php endif ?><?php endforeach ?></div>

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By claire - July 16, 2014

Hi Jerry

Just on the off-chance this works - try changing the function like so:

<script>
function copylist(id)
{
    var divcontents = document.getElementById('list'+id);
    var text = divcontents.innerHTML;
    var finaltext = text.replace(/<br ?\/?>/g, "\n");
    window.prompt("Copy to Clipboard: CMD (CTL) +C To Copy - Press OK", finaltext);
}
</script>

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By gkornbluth - July 16, 2014

Hi Claire,

No, sorry, same issue.

I have a feeling that it is a clipboard issue. The replace is working but formatting doesn't get passed through the windows clipboard.

I did some Googling  for copy carriage returns in clipboard and tied replacing the <br> with \r\n but that didn't help.

There was some discussion about using Environment.NewLine to get around the clipboard issue, but I'm afraid it's all way over my programming head.

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By claire - July 17, 2014

Hi Jerry

I think you'll have to use jQuery at this point. It'd give you some options, more or less.

I'd do it with a hidden textarea - basically you'd insert the email addresses into the box, set its contents to be automatically selected, then show the textarea in its own div somewhere on the screen, maybe above the email addresses. Then all you have to do is hit Ctrl+C and close the box.

I believe a textarea will interpret the \n character properly.

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By gkornbluth - July 17, 2014

Hi Claire,

I know you're probably right, but I must admit, I don't even know where to start.

Hope you, or someone, can offer more specific coding suggestions.

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By gkornbluth - July 18, 2014

Thanks Claire

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php