Page 1 of 1

custom fields

Posted: 08 Oct 2019, 20:56
by PersonalAgentin
I created a simple text field during the job posting and can also output it.

How can I check a field if it contains any value or a certain value?

Re: custom fields and conditional output

Posted: 15 Oct 2019, 14:53
by PersonalAgentin
I have created a field "Driver's license". This field contains the required driving licence class. I only want to display the content of the field if something has been entered.

*** if !<extraField-Driving Licence>=='' ***
<tr>
<td class="detailsHeader"><strong>needed licence class:</strong></td>
<td><extraField driving licence></td>
</tr>
*** endif ***

No one has an idea? Or is that not possible?

Re: custom fields

Posted: 15 Oct 2019, 20:41
by rob
You are going to have to put some logic in the Show.tpl files when the extra fields are displayed for each of the modules in question.
Assuming you just need to modify candidates everything you need to do is below.

So for example on the Candidates it's in modules/candidates/Show.tpl
Code: Select all
 
Orig code:
<?php for ($i = (intval(count($this->extraFieldRS))/2); $i < (count($this->extraFieldRS)); $i++): ?>
  <tr>
     <td class="vertical"><?php $this->_($this->extraFieldRS[$i]['fieldName']); ?>:</td>
     <td class="data"><?php echo($this->extraFieldRS[$i]['display']); ?></td>
  </tr>
 <?php endfor; ?>
Code: Select all
Modified code:
<?php for ($i = (intval(count($this->extraFieldRS))/2); $i < (count($this->extraFieldRS)); $i++): ?>
 <tr>
   <?php if($this->extraFieldRS[$i]['fieldName'] == "Driver's license") {  ?>
			<?php if ($this->extraFieldRS[$i]['display']){  ?>
				  <td class="vertical"><?php $this->_($this->extraFieldRS[$i]['fieldName']); ?>:</td>
				  <td class="data"><?php echo($this->extraFieldRS[$i]['display']); ?></td>
			<?php } ?>
   <?php }else{ ?>
		  <td class="vertical"><?php $this->_($this->extraFieldRS[$i]['fieldName']); ?>:</td>
		  <td class="data"><?php echo($this->extraFieldRS[$i]['display']); ?></td>
   <?php } ?>
 </tr>
<?php endfor; ?>


Note: On these Show.Tpl pages there are 2 columns displaying the fields so that means there are 2 different sections in the code that handle the extra fields. So if you change this and its not reflecting on the site, you added it to the opposing column.