This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Change in date display in send form?


  1. MvdL79
    Member

    Yuniar is it possible to make the forms, which are filled in and received in our mailbox, display the date like this: DD-MM-YYYY?

    Currently it shows: YYYY-MM-DD

    Would be easier for us to work with. Thanks!

    Posted 15 years ago #
  2. MvdL79
    Member

    One more request: the submitted form removes empty (or not used fields), this is really great. However when you review the filled in form, it does show those fields.

    Is it possible to remove it on review page as well? So the not filled in fields are removed as well there (just like in the submitted form you receive by email)?

    Posted 15 years ago #
  3. yuniar

    Which date shows YYYY-MM-DD? Is your form having date fields?
    The date field already use DD-MM-YYYY or MM-DD-YYYY.

    To remove empty fields from your review page, edit includes/view-functions.php file, search around line 2330 and you'll find this code:

    foreach ($entry_details as $data){

    Right under that line, insert this code:

    if($data['value'] == ' '){
    	continue;
    }


    that would remove empty fields.


    MachForm Founder

    Posted 15 years ago #
  4. MvdL79
    Member

    Regarding date:
    I mean the submitted form, when your receive it by email and you use {date_created} in the email template. It WILL show YYYY-MM-DD.

    Regarding empty fields:
    Well after several tries, I have to conclude I should USE the empty fields, cause otherwise it will look weird with use of the pulldown's and radio button. Anyways, to hard to explain. Sorry.

    New problem / question:
    Is there a way to use product codes in your order form.

    For example:
    You have a choice of webhosting packages WEB 1, WEB 2 and WEB 3.
    The customer selects WEB 2 on the order form and sends the order form to us.
    Then we receive the order form with WEB 2 & productcode 52001. The customer does and will not see the productcode.

    Is this possible? Please advice, cause this would be great for our billing department. We are currently solving this problem by showing the productcode on the form.

    Posted 15 years ago #
  5. yuniar

    To change the date, edit includes/helper-functions.php file, search around line 291:

    $query = "select date_created,ip_address from ap_form_{$form_id} where id='$entry_id'";

    change it to:

    $query = "select date_format(date_created,'%d-%m-%Y') date_created,ip_address from ap_form_{$form_id} where id='$entry_id'";

    Regarding product code, you can simply hide your current product code field using some CSS code.

    For example, if your product code field is having id = "element_3", then add this CSS code:

    #li_3 { display: none; }

    that would hide your field.


    MachForm Founder

    Posted 15 years ago #
  6. MvdL79
    Member

    Okay thanks Yuniar, I will try both.

    And as for the hidden product code; it will show up on the order we receive by email, right?

    Posted 15 years ago #
  7. MvdL79
    Member

    Okay the date shows correctly, however it does not show the time anymore. Which is also critical for our order forms. Do you have a fix for that?

    And regarding the product code, I don't think what you recommend will work.

    I will try to explain with an example; you have an order form where you can select a webhostingpackage, like this:

    Webhostingplan 1 (code 5220)
    Webhostingplan 2 (code 5221)
    Webhostingplan 3 (code 5222)

    On the form itself and on the review form page, it should only show Webhostingplan 2, without the code. When the order form is sent it should show Webhostingplan 2 (code 5221).

    Posted 15 years ago #
  8. yuniar

    Ooops.. sorry I forgot the time!

    Ok, use this one instead:

    $query = "select date_format(date_created,'%d-%m-%Y %H:%i:%s') date_created,ip_address from ap_form_{$form_id} where id='$entry_id'";


    MachForm Founder

    Posted 15 years ago #
  9. yuniar

    Regarding the product code.. hmm.. can you paste me the HTML code for your drop down?
    Also what is your form id number?


    MachForm Founder

    Posted 15 years ago #
  10. MvdL79
    Member

    Thanks for the quick response.

    I edited the date/time code. So it should work now.

    As for the HTML code with the webhostingpackages:

    <input id="element_15_1" name="element_15" class="element radio" type="radio" value="1" checked="checked" />
    <label class="choice" for="element_15_1">eD.50MB webhostingpakket van 45,- Euro per jaar</label>
    <input id="element_15_2" name="element_15" class="element radio" type="radio" value="2" />
    <label class="choice" for="element_15_2">eD.100MB webhostingpakket van 70,- Euro per jaar</label>
    <input id="element_15_3" name="element_15" class="element radio" type="radio" value="3" />
    <label class="choice" for="element_15_3">eD.200MB webhostingpakket van 90,- Euro per jaar</label>
    <input id="element_15_4" name="element_15" class="element radio" type="radio" value="4" />
    <label class="choice" for="element_15_4">eD.400MB webhostingpakket van 118,- Euro per jaar</label>
    <input id="element_15_5" name="element_15" class="element radio" type="radio" value="5" />
    <label class="choice" for="element_15_5">eD.600MB webhostingpakket van 148,- Euro per jaar</label>
    <input id="element_15_6" name="element_15" class="element radio" type="radio" value="6" />
    <label class="choice" for="element_15_6">eD.1000MB webhostingpakket van 193,- Euro per jaar</label>

    I take it, this is what you mean?

    //edit

    It's not a pulldown, but a radio-button field. :)

    Posted 15 years ago #
  11. yuniar

    great, ok what's your form id number? also, let me know the product code for each radio button.


    MachForm Founder

    Posted 15 years ago #
  12. MvdL79
    Member

    Sorry. :)

    Form ID number = 3

    eD.50MB webhostingpakket van 45,- Euro per jaar -> 20006
    eD.100MB webhostingpakket van 70,- Euro per jaar -> 20000
    eD.200MB webhostingpakket van 90,- Euro per jaar -> 20001
    eD.400MB webhostingpakket van 118,- Euro per jaar -> 20003
    eD.600MB webhostingpakket van 148,- Euro per jaar -> 20004
    eD.1000MB webhostingpakket van 193,- Euro per jaar -> 20005

    The numbers at the end are the productcodes.

    Though I totally appreciate what you are doing for me, can you not explain me what I have to exactly, cause I have 9 other forms, which need also productcodes. So if I know how to do it, I could do it myself instead of bothering you with this. ;)

    Thanks again so far!

    Posted 15 years ago #
  13. MvdL79
    Member

    Any news yet, so I can continue on my forms?

    Posted 15 years ago #
  14. yuniar

    Sorry for the delay!
    I was trying to figure out the easiest way for you.

    Ok, here we go. Edit your includes/helper-functions.php file.
    Exactly at line 287, you'll find this code:

    $i++;

    right ABOVE that line, insert the code below:

    if($data['element_type'] == 'radio' && $target_is_admin === true){
    	if($form_id == 3){
    		if($data['element_id'] == 15){
    
    			if($data['value'] == "eD.50MB webhostingpakket van 45,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20006)";
    			}elseif($data['value'] == "eD.100MB webhostingpakket van 70,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20000)";
    			}elseif($data['value'] == "eD.200MB webhostingpakket van 90,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20001)";
    			}elseif($data['value'] == "eD.400MB webhostingpakket van 118,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20003)";
    			}elseif($data['value'] == "eD.600MB webhostingpakket van 148,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20004)";
    			}elseif($data['value'] == "eD.1000MB webhostingpakket van 193,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20005)";
    			}
    
    		}
    	}
    }


    That should do it.

    If the code above doesn't clear, use this one:
    http://mf.pastebin.com/f793d494


    MachForm Founder

    Posted 15 years ago #
  15. MvdL79
    Member

    Hi Yuniar,

    Thanks for the answer. First solution worked without problems! Thanks.

    I take it, if I do the same with my other order forms, I can use this every time? For different products?

    Should I pay close attention to something, or would this work without problems?

    Posted 15 years ago #
  16. yuniar

    To use it for another form, you need to duplicate the above code and adjust some values there. Particularly: form_id, element_id and those product codes.

    So if you have few forms, your code would be something like this:

    if($data['element_type'] == 'radio' && $target_is_admin === true){
    	if($form_id == 3){
    		.. first form code here ...
    	}
    
    	if($form_id == 4){
    		.. second form code here ...
    	}
    
    	if($form_id == 5){
    		.. third form code here ...
    	}
    
    	if($form_id == 6){
    		.. fourth form code here ...
    	}
    }


    MachForm Founder

    Posted 15 years ago #
  17. MvdL79
    Member

    Okay great, I take it works for pulldowns as well etc?

    Posted 15 years ago #
  18. MvdL79
    Member

    Uhmz... Another problem?

    I added it for a different form as well, for the TLDs (for domainnames), which is a pulldown field:

    if($form_id == 2){
    if($data['element_id'] == 3){

    if($data['value'] == ".NL"){
    $entry_details[$i]['value'] .= " [Art.01000]";
    }elseif($data['value'] == ".NU"){
    $entry_details[$i]['value'] .= " [Art.01004]";
    }elseif($data['value'] == ".BE"){
    $entry_details[$i]['value'] .= " [Art.01005]";
    }elseif($data['value'] == ".DE"){
    $entry_details[$i]['value'] .= " [Art.01010]";
    }elseif($data['value'] == ".EU"){
    $entry_details[$i]['value'] .= " [Art.01015]";
    }elseif($data['value'] == ".COM"){
    $entry_details[$i]['value'] .= " [Art.01001]";
    }elseif($data['value'] == ".NET"){
    $entry_details[$i]['value'] .= " [Art.01002]";
    }elseif($data['value'] == ".ORG"){
    $entry_details[$i]['value'] .= " [Art.01003]";
    }elseif($data['value'] == ".INFO"){
    $entry_details[$i]['value'] .= " [Art.01008]";
    }elseif($data['value'] == ".BIZ"){
    $entry_details[$i]['value'] .= " [Art.01006]";
    }elseif($data['value'] == ".NAME"){
    $entry_details[$i]['value'] .= " [Art.01016]";
    }elseif($data['value'] == ".CO.UK"){
    $entry_details[$i]['value'] .= " [Art.01012]";
    }elseif($data['value'] == ".CA"){
    $entry_details[$i]['value'] .= " [Art.01017]";
    }elseif($data['value'] == ".CC"){
    $entry_details[$i]['value'] .= " [Art.01018]";
    }elseif($data['value'] == ".MOBI"){
    $entry_details[$i]['value'] .= " [Art.01019]";
    }elseif($data['value'] == ".TV"){
    $entry_details[$i]['value'] .= " [Art.01007]";
    }elseif($data['value'] == ".WS"){
    $entry_details[$i]['value'] .= " [Art.01009]";
    }

    }
    }

    I checked the form_id, which is correct (2) and I checked the element_id, which is also correct (3), but it does not show anything when the form is submitted.

    Posted 15 years ago #
  19. MvdL79
    Member

    I also added this: if($data['element_type'] == 'select' && $target_is_admin === true){

    but it does not work?

    Posted 15 years ago #
  20. MvdL79
    Member

    Uhmz... it seems if I remove if($data['element_type'] == 'radio' && $target_is_admin === true){

    And replace it with if($data['element_type'] == 'select' && $target_is_admin === true){

    It works... Any way to combine those two?
    Also some fields are on the same form.

    //edit #1

    Woohoo! I managed to get it working! And I don't know anything about PHP!

    I edited to this:

    if($data['element_type'] == 'select' OR 'radio' && $target_is_admin === true){

    Is this correct....?
    ...anyways it works!

    //edit #2

    The following code will not cause any problems, right?

    if($form_id == 2 OR 3 OR 4){
    if($data['element_id'] == 3 OR 43 OR 45 OR 51 OR 53 OR 59){

    Posted 15 years ago #

RSS feed for this topic

Reply »