com_contact custum fileds in forms

For Joomla! 3.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Locked
oleg_kosarev
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Jan 12, 2018 11:26 pm

com_contact custum fileds in forms

Post by oleg_kosarev » Fri Jan 12, 2018 11:46 pm

1) copy files
from /components/com_contact/models/forms/contact.xml
to /templates/template_name/html/com_contact/contact/remind/contact.xml
add extra files to contact.xml
example

Code: Select all

        <field name="name_extra_fileds" type="list" default="" id="name_extra_fileds" class="selectpicker form-control" label="Select an option" description="Select an option desk">
            <option value="" disabled="">-(Select)-</option>
            <option value="options1">options1_title</option>
            <option value="options2">options2_title</option>
            <option value="options3">options3_title</option>
            <option value="options4">options4_title</option>
        </field>
This example from https://docs.joomla.org/Standard_form_field_types
2) copy files
from /components/com_contact/views/contact/tmpl/default_form.php
to /templates/template_name/html/com_contact/contact/default_form.php

3) edit default_form.php

Code: Select all

JLoader::import("joomla.version");
$version = new JVersion();
if (!version_compare($version->RELEASE, "2.5", "<=")):
    if (!defined("DS")):
        define("DS", DIRECTORY_SEPARATOR);
    endif;
endif;
$this->form->reset(true);
$this->form->loadFile(dirname(__FILE__) . DS . "remind/contact.xml");
And ok extra files show and work BUT options not translate from lang. files and render

Code: Select all

<select id="jform_name_extra_fileds" name="jform[name_extra_fileds]" class="selectpicker form-control">
            <option value="" disabled="">-(Select)-</option>
            <option value="COM_CONTACT_EMAIL_LABEL">COM_CONTACT_EMAIL_LABEL</option>
            <option value="options2">options2_title</option>
            <option value="options3">options3_title</option>
            <option value="options4">options4_title</option>
</select>
This is bug or code error?

Locked

Return to “Joomla! 3.x Coding”