Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Aug 2013
    Posts
    157
    Thanks
    23
    Thanked 0 Times in 0 Posts

    Emailing Div Contents instead of a form

    Can you contents of a div instead of having a form. I have an invoice set up that I would like to email to the customers email when submitted.

    I will simplify the hell out of this for understanding sake.

    Code:
    <div id="container1">
    <div id="content">This has contnet</div>
    </div>
    
    [print button thats prints container1]   [email button that emails container1]
    
    <div id="container2">
    <div id="content">This has contnet</div>
    </div>
    
    [print button thats prints container1]   [email button that emails container1]
    Could I use jquery like this
    $("myDiv").printElement();


    Also does it preserve the css styles in the container?

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,680
    Thanks
    6
    Thanked 1,009 Times in 982 Posts
    What’s the point? What’s so hard about having a form instead of a div?
    And to e-mail anything you need a server-side script anyway. JS can’t help you here.

  • #3
    Regular Coder
    Join Date
    Aug 2013
    Posts
    157
    Thanks
    23
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by VIPStephan View Post
    What’s the point? What’s so hard about having a form instead of a div?
    And to e-mail anything you need a server-side script anyway. JS can’t help you here.


    Because I'm not emailing something that can be put into a form format

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,680
    Thanks
    6
    Thanked 1,009 Times in 982 Posts
    What are you e-mailing then?

  • #5
    Regular Coder
    Join Date
    Aug 2013
    Posts
    157
    Thanks
    23
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by VIPStephan View Post
    What are you e-mailing then?

    It's a page where using PHP it displays all the Invoices and all the information is drawn from a database submitted in other forms.

    Then I have a div wrapper around each index with for example.. <div id="invoiceWrapper".$row['product_id']."></div>

    So each invoice container has a seperate wrapper id so Im assuming I could make an email/print button selecting the div related to the invoice I want to send.

    I supposed I could do it in a form, but graphically for the invoice it's a lot nicer and I'm pretty sure theres a way you can just select a div ID and email that Div or pritn that Div no?

  • #6
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,680
    Thanks
    6
    Thanked 1,009 Times in 982 Posts
    Printing a div is no problem but I see no way to use JS to e-mail something (except by opening the default e-mail client which is unreliable and therefore not recommended). Even if you were using a form you would need a server-side script.

    You know, using forms you could make the invoice stuff inputs or textareas with “readonly” attribute, and style it with CSS to look like regular text. Then, if you press the “send” button it would send the contents of these form fields.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •