facebook

Adding formatting to a form generated email

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #346487 Reply

    JustinDupuy
    Member

    I have created a vehicle inspection app that works similar to your example entitled “creating a survey and emailing results”.
    found here:
    http://www.genuitec.com/mobile/docs/surveyEmailForm/resources/survey_example.zip

    I have been trying to figure out how to format the email so it isn’t so bland. I’d like it to look more like a spreadsheet or a cleanly laid out form. In your example, you have:
    Q1: boxers
    Q2: rock

    I have alot more data to display, so formatting would help. I realize the best way to do this would probably be to create a server side form and let the app populate that using php (since this app is for our company only), but I am still pretty new at this and haven’t tackled php yet. Do you have any suggestions?

    #346576 Reply

    Brandon
    Member

    You could use HTML formatting in javascript.
    Example:
    yourNewVariable = “<u>This is correct!</u>”;
    myFinalText = “Your answer to <b>Question 1</b> was <b> Q1: boxers</b> ” + yourNewVariable;

    then send that to an email or an HTML widget.

    #346713 Reply

    JustinDupuy
    Member

    Thank you for your help… I am still struggling though. I’m sure it’s something easy.

    SummaryTextArea is a text area input variable that populates from the results of page 1. It sends as a form in email format.

    //runs upon opening results page
    function updateSummary() {

    var currentMiles = $(‘input[name=”MilesHours”]’).val();
    var serviceDue = $(‘input[name=”NextServiceDue”]’).val();
    var result = “”;

    //get heading data
    result += $(‘input[name=”TruckNumber”]’).val() + ” “;
    result += $(‘input[name=”PerformedBy”]’).val() + ” “;
    result += $(‘input[name=”Date”]’).val() + “\n\n”;
    result += “JobNumber:\t\t” + $(‘input[name=”JobNumber”]’).val() + “\n”;
    result += “Current Miles/Hours:\t” + $(‘input[name=”MilesHours”]’).val() + “\n”;
    result += “Next Service Due:\t\t” + $(‘input[name=”NextServiceDue”]’).val() + “\n”;
    if (serviceDue < currentMiles) {
    result += “***SERVICE DUE***” + “\n\n”}
    else {
    result += “\n”
    }

    //get fluids result
    result += “Fluids: ” + “\t\t\t\t” + $(‘input[name=”Fluids”]:checked’).val() + “\n”;

    //get belts result
    result += “Belts:” + “\t\t\t\t\t” + $(‘input[name=”Belts”]:checked’).val() + “\n”;

    //get belts result
    result += “Hoses and Fittings: ” + “\t\t” + $(‘input[name=”Hoses”]:checked’).val() + “\n”;

    //get text area result
    result += “Notes: ” + $(‘#m1-mscEquipmentInspection-Notes’).val() + “\n”;
    //example $(‘#form1-textArea1’).val()

    //get belts result
    result += “================================” + “\n”;

    //update summary page
    $(‘[id$=summaryTextArea]’).text(result);
    }

    So my existing code below:
    //get belts result
    result += “Belts:” + “\t\t\t\t\t” + $(‘input[name=”Belts”]:checked’).val() + “\n”;
    //get Hoses and fittings result
    result += “Hoses and Fittings: ” + “\t\t” + $(‘input[name=”Hoses”]:checked’).val() + “\n”;

    Which results:
    Belts: Good
    Hoses and Fittings: Bad

    You are suggesting (as an example) to change to:
    //get belts result
    result += “<b>Belts:</b>” + “\t\t\t\t\t” + $(‘input[name=”Belts”]:checked’).val() + “\n”;

    //get Hoses and fittings result
    result += “<b>Hoses and Fittings: </b>” + “\t\t” + $(‘input[name=”Hoses”]:checked’).val() + “\n”;

    Doesn’t give me the expected bold headings. It just prints line as <b>Belts:</b> etc…
    What am I missing?

    Could you confirm what code I am using…jquery I believe? That would at least narrow down my searching.
    many thanks!

    #346714 Reply

    Brandon
    Member

    You dont seem to be missing anything, just the final result.
    It is printing out the code, <b>, because your are placing that into a textbox. Text boxes cannot show html formatted text. If you place it in an HTML widget, or if the email recipient has it on to show html it should show correctly.

    #346715 Reply

    JustinDupuy
    Member

    OK great! I’ll mess around with it.
    Thanks for the help!

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Adding formatting to a form generated email

You must be logged in to post in the forum log in