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

Sending only entrys with value.


  1. jaimar
    Member

    Hi Yunar and Redityo,

    I just want to ask if how to send only those field with value. and not show those field without value to my email when it sent..

    for example i have two dropdown (1 and 2) with default value="Choose One"

    and if the client selected only in dropdown one(1), the dropdown two(2) are not included to email notification..

    Thank you

    Posted 14 years ago #
  2. redityo

    Hi,

    By default machform won't sending a field with no value. I think what your need is, not sending a drop down with value "Choose One" . If I'm right, you can edit "includes/helper-functions.php" file and add same condition in there. Let say you've those drop down value in form 49, then go around line 331 ~ 333 you will see these code :

    if((empty($data['value']) || $data['value'] == ' ') && $data['value'] !== 0 && $data['value'] !== '0'){
    	continue;
    }

    you can put these code bellow that line

    if ($data['element_type'] == "select" && $form_id == '49' && $data['value'] == 'Choose One') {
    	continue ;
    }

    and if you're using "simple text" mail, go to around line 373 ~ 375 you will see the same code like this :

    if((empty($data['value']) || $data['value'] == ' ') && $data['value'] !== 0 && $data['value'] !== '0'){
    	continue;
    }

    and put the same validation code bellow that line

    if ($data['element_type'] == "select" && $form_id == '49' && $data['value'] == 'Choose One') {
    	continue ;
    }

    MachForm Support

    Posted 14 years ago #
  3. jaimar
    Member

    Your the best Mr.Redityo obcourse Sir Yuniar as well...
    Your guide is perfectly working.. Thanks again.. by the way Master Redityo
    can you guide me one more time. i think its in the helper-function.php...
    I just want also to hide all the DROP DOWN with 'Choose One' value, when viewing
    EDIT ENTRY SECTION

    More power Machform,

    Jaimar

    Posted 14 years ago #
  4. jaimar
    Member

    UP! Please reply..

    Posted 14 years ago #
  5. johntorre
    Member

    Same problem here.. UP!

    Posted 14 years ago #
  6. redityo

    Sorry for the delay :) .. anyway to hide the value in view entry, you need to edit "view_entry.php" file. Go to around line 132, then you will see this code :

    foreach ($entry_details as $data){

    put these code exactly bellow that line

    if ($data['element_type'] == "select" && $form_id == '49' && $data['value'] == 'Choose One') {
    	continue ;
    }

    MachForm Support

    Posted 14 years ago #
  7. jaimar
    Member

    Thanks for the reply Sir. But the code you have posted was already answered here

    http://www.appnitro.com/forums/topic/hiding-emptydefault-value-in-review-page?replies=4

    for hiding the view_entry.php..

    im so sorry but what im trying to asked for help is the EDIT_ENTRY Section.. where you can view and edit the sent form.. Please reply Sir Redityo... Godbless!

    Posted 14 years ago #
  8. redityo

    Ah ... my above code is to hide the entries when you view the entry. Anyway to hide the field in edit entries page, you should edit "view-functions.php". Let say your have these information in your form :

    1. Form id : 79
    2. Drop Down Field ID : 2
    3. "Choose One" option located in position 2

    Then try to follow these steps :

    1. Go to around line 653 ~ 662, you will see these code :

    $element_markup = <<<EOT
    		<li  id="li_{$element->id}" {$error_class}>
    		<label class="description" for="element_{$element->id}">{$element->title} {$span_required}</label>
    		<div>
    		<select class="element select {$element->size}" id="element_{$element->id}" name="element_{$element->id}">
    			{$option_markup}
    		</select>
    		</div>{$guidelines} {$error_message}
    		</li>
    EOT;

    replace it with

    if ($element->is_hide)
    {
    $hide_element = "style=display:none !important";
    }
    
    $element_markup = <<<EOT
    		<li {$hide_element} id="li_{$element->id}" {$error_class}>
    		<label class="description" for="element_{$element->id}">{$element->title} {$span_required}</label>
    		<div>
    		<select class="element select {$element->size}" id="element_{$element->id}" name="element_{$element->id}">
    			{$option_markup}
    		</select>
    		</div>{$guidelines} {$error_message}
    		</li>
    EOT;

    2. Go to line 2062 ~ 2064, you will see this :

    if($element_data->is_private && empty($_SESSION['logged_in'])){ //don't show private element
    	continue;
    }

    add the code bellow that line, the code should be like this

    if($element_data->is_private && empty($_SESSION['logged_in'])){ //don't show private element
    	continue;
    }
    
    //don't forget to adjust these information
    if ($element_data->id == 2  &&
    	$form_id == 79 &&
    	!empty($edit_id) &&
    	$edit_id != 0 &&
    	$element_data->populated_value['element_'.$element_data->id]['default_value'] == 2) {
    	$element_data->is_hide = true;
    }

    MachForm Support

    Posted 14 years ago #
  9. jaimar
    Member

    AWESOME! Thanks Mr. Redityo! your the best...

    UP! :)

    Posted 14 years ago #

RSS feed for this topic

Reply