Keyword

Calling out extra fields in front-end submissions

  • CherylV
  • CherylV's Avatar Topic Author
  • Offline
  • New Member
More
11 years 8 months ago #109129 by CherylV
Hi,

I am new to php and need some help customizing my itemform.php. The goal is the following:

1. Front-end submission into just 1 of my K2 categories, with no other categories showing in drop-down.

2. Appropriate extra-fields load automatically, without user needing to select (child-)category. (Note that all 5 child categories have the same extra fields).

3. Display some of the extra fields in the top 'admin' table, with others distributed among the tabs at the bottom

I had gotten the form working before with all except (3) above. However, although I haven't edited the file, I apparently did something in the site to 'break it' as it is now not loading the extra fields at all -- even after you select a category.

I would really appreciate code I can use to (1) specify the parent category and (2) call out the individual extra fields by id# in the context of itemform.php. (I haven't upgraded to the new K2 because it is not yet supported by the component I use to integrate K2 with JomSocial-- something I posted on but did not hear back. Alternatively, help figuring out what I might have done to 'break' the somewhat-kludged solution I'd had before would be much appreciated!!

Here is the code that was working before:

<ul id="k2ExtraFieldsValidationResults"></ul>
<?php if (count($this->extraFields)): ?>
<?php foreach($this->extraFields as $extraField): ?>
<tr>
<td class="adminK2LeftCol"><span class="title" style="font-weight:bold">
<?php echo $extraField->name; ?></span>
</td>
<td class="adminK2RightCol">
<?php echo $extraField->element; ?>
</td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<dl id="system-message">
<dt class="notice"><?php echo JText::_('K2_NOTICE'); ?></dt>
<dd class="notice message fade">
<ul>
<li><?php echo JText::_('K2_PLEASE_SELECT_A_CATEGORY_FIRST_TO_RETRIEVE_ITS_RELATED_EXTRA_FIELDS'); ?></li>
</ul>
</dd>
</dl>
<?php endif; ?>
<?php if (count($this->K2PluginsItemExtraFields)): ?>
<div class="itemPlugins">
<?php foreach($this->K2PluginsItemExtraFields as $K2Plugin): ?>
<?php if(!is_null($K2Plugin)): ?>
<fieldset>
<legend><?php echo $K2Plugin->name; ?></legend>
<?php echo $K2Plugin->fields; ?>
</fieldset>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>

Thank you!!
Cheryl

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum