No Code Attached Yet
avatar brianteeman
brianteeman
21 Oct 2022

Steps to reproduce the issue

Create a contact and a menu link to display the contact
Create a custom field for contacts with the context mail
image

The custom fields are rendered as a fieldset after the core fields eg
Name
Email
Subject
Message
CUSTOM FIELD

In all other places you can manually render the fields using

echo $field->renderField('name');

and then following the documentation at https://docs.joomla.org/J3.x:Adding_custom_fields/Overrides you can get each custom field.

So now I would be able to render the fields
Name
CUSTOM FIELD
Email
Subject
Message

the problem

The documented method does not work in this context and I can't find out how to get the field to render.

Either there is a bug or there is missing documentation or Brian is missing a brain ?

cc @laoneo

avatar brianteeman brianteeman - open - 21 Oct 2022
avatar joomla-cms-bot joomla-cms-bot - change - 21 Oct 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 21 Oct 2022
avatar brianteeman brianteeman - change - 21 Oct 2022
Title
custom fields on com_
custom fields on com_contact mail form
avatar brianteeman brianteeman - edited - 21 Oct 2022
avatar brianteeman brianteeman - change - 21 Oct 2022
The description was changed
avatar brianteeman brianteeman - edited - 21 Oct 2022
avatar drmenzelit
drmenzelit - comment - 21 Oct 2022

In the form you need to load the form elements not render the field:
<?php echo $this->form->getLabel('contact_name'); ?>
<?php echo $this->form->getInput('contact_name'); ?>

I wrote a blog (German) here: https://wicked-software.de/dynamisches-kontaktformular-mit-auswahlfelder

avatar brianteeman brianteeman - change - 21 Oct 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-10-21 12:37:11
Closed_By brianteeman
avatar brianteeman brianteeman - close - 21 Oct 2022
avatar brianteeman
brianteeman - comment - 21 Oct 2022

Thanks for the post

I can see now that you can render the field you just need to set the correct values - which I now have from your post

    <?php echo $this->form->renderField('contact_name'); ?>
    <?php echo $this->form->renderField('country', 'com_fields'); ?>
    <?php echo $this->form->renderField('contact_email'); ?>

Add a Comment

Login with GitHub to post a comment