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

hiding empty/default value in review page?


  1. johntorre
    Member

    Sir Redityo,

    Is it possible to hide the form field with no value or with default selected value in the REVIEW PAGE SECTION??? already found the script section in view-function.php but dont know how to execute..

    THanks

    Posted 15 years ago #
  2. redityo

    To hide a field with no value, try to edit your "view-functions.php" and go around line 2334 ~ 2350, you will see these code :

    foreach ($entry_details as $data){
    	if($toggle){
    		$toggle = false;
    		$row_style = 'class="alt"';
    	}else{
    		$toggle = true;
    		$row_style = '';
    	}	
    
    	$entry_data .= "<tr {$row_style}>\n";
    	$entry_data .= "<td width=\"40%\"><strong>{$data['label']}</strong></td>\n";
    	$entry_data .= "<td width=\"60%\">".nl2br($data['value'])."</td>\n";
    	$entry_data .= "</tr>\n";
    }

    try to replace with this one

    foreach ($entry_details as $data){
    	if (empty($data['value']) || ($data['value'] == '')) {
    		continue;
    	}
    	if($toggle){
    		$toggle = false;
    		$row_style = 'class="alt"';
    	}else{
    		$toggle = true;
    		$row_style = '';
    	}	
    
    	$entry_data .= "<tr {$row_style}>\n";
    	$entry_data .= "<td width=\"40%\"><strong>{$data['label']}</strong></td>\n";
    	$entry_data .= "<td width=\"60%\">".nl2br($data['value'])."</td>\n";
    	$entry_data .= "</tr>\n";
    }

    MachForm Support

    Posted 15 years ago #
  3. johntorre
    Member

    if (empty($data['value']) || ($data['value'] == '')) {
    

    Hi Sir Redityo thanks for this.. But when testing. it does not hide the <tr> or the field without value. but when i put some value at this line

    ($data['value'] == 'some value here'))
    and when typing
    some value here in the input field and try to continue to review page input field hide itself..

    Posted 15 years ago #
  4. redityo

    Hmmm.. it's work fine with me when I test with a "text box" field. However I think the code need to be updated, first try to update the code from :

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

    to

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

    that code should handle options element like drop down to be hide or check box field in review page. Then edit your "view-functions.php" file again and go to around line 2438 ~ 2453, you will see these code :

    foreach ($entry_details as $data){ 
    
    	if($toggle){
    		$toggle = false;
    		$row_style = 'class="alt"';
    	}else{
    		$toggle = true;
    		$row_style = '';
    	}	
    
    	$entry_data .= "<tr {$row_style}>\n";
    	$entry_data .= "<td width=\"40%\"><strong>{$data['label']}</strong></td>\n";
    	$entry_data .= "<td width=\"60%\">".nl2br($data['value'])."</td>\n";
    	$entry_data .= "</tr>\n";
    }

    replace with this one

    foreach ($entry_details as $data){
    	if ((empty($data['value']) || $data['value'] == '&nbsp;') &&
    		$data['value'] !== 0 && $data['value'] !== '0') {
    		continue;
    	}
    	if($toggle){
    		$toggle = false;
    		$row_style = 'class="alt"';
    	}else{
    		$toggle = true;
    		$row_style = '';
    	}	
    
    	$entry_data .= "<tr {$row_style}>\n";
    	$entry_data .= "<td width=\"40%\"><strong>{$data['label']}</strong></td>\n";
    	$entry_data .= "<td width=\"60%\">".nl2br($data['value'])."</td>\n";
    	$entry_data .= "</tr>\n";
    }

    Those code will handle review page when using advance embed code


    MachForm Support

    Posted 15 years ago #

RSS feed for this topic

Reply