Create a contact and a menu link to display the contact
Create a custom field for contacts with the context mail
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 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
Labels |
Added:
No Code Attached Yet
|
Title |
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-10-21 12:37:11 |
Closed_By | ⇒ | brianteeman |
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'); ?>
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