Creating Bootstrap 3 contact form

355 views
Skip to first unread message

Troy

unread,
Jan 15, 2015, 11:00:26 PM1/15/15
to joomla-dev-general

Would anyone care to tutor me on making a nice contact form using
bootstrap 3 for Joomla 3.4 ?
Been trying to convert
http://bootsnipp.com/snippets/featured/bootstrap-3x-contact-form-layout
as a sample, but running into issues.
-- Bear

Seth Warburton

unread,
Jan 16, 2015, 6:46:54 AM1/16/15
to joomla-de...@googlegroups.com
It depends somewhat on your definition of nice. You can do whatever you want with a template override of com_contact simply by swapping out BS2.3 markup for BS3 markup. That's exactly what I did:

Troy

unread,
Jan 16, 2015, 10:42:10 AM1/16/15
to joomla-de...@googlegroups.com
thats what I've been doing seth,
                    <div class="form-group">
                        <?php echo $this->form->getLabel('contact_name'); ?>
                        <div class="input-group">
                            <?php echo $this->form->getInput('contact_name'); ?>
                            <span class="input-group-addon"><i class="glyphicon glyphicon-ok form-control-feedback"></i></span>
                        </div>
                    </div>
the main issue I think, is that I can't seem to figure out how to pass a class or other info to the  <?php echo $this->form->getInput('contact_name'); ?>  type statements.  I tried looking it up but my brain just kinda shut down :(
Bear
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.


No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5645 / Virus Database: 4260/8939 - Release Date: 01/16/15


Viper

unread,
Jan 16, 2015, 11:04:41 AM1/16/15
to joomla-de...@googlegroups.com
<field name="contact_name" type="text" default="" label="JFIELD_GLOBAL_TITLE_LABEL" class="span5" required="true" filter="string" size="45" />



On Friday, January 16, 2015 at 6:42:10 PM UTC+3, Bear wrote:
thats what I've been doing seth,
                    <div class="form-group">
                        <?php echo $this->form->getLabel('contact_name'); ?>
                        <div class="input-group">
                            <?php echo $this->form->getInput('contact_name'); ?>
                            <span class="input-group-addon"><i class="glyphicon glyphicon-ok form-control-feedback"></i></span>
                        </div>
                    </div>
the main issue I think, is that I can't seem to figure out how to pass a class or other info to the  <?php echo $this->form->getInput('contact_name'); ?>  type statements.  I tried looking it up but my brain just kinda shut down :(
Bear
On 1/16/2015 05:46, Seth Warburton wrote:
It depends somewhat on your definition of nice. You can do whatever you want with a template override of com_contact simply by swapping out BS2.3 markup for BS3 markup. That's exactly what I did:




On Friday, 16 January 2015 04:00:26 UTC, Bear wrote:

Would anyone care to tutor me on making a nice contact form using
bootstrap 3 for Joomla 3.4 ?
Been trying to convert
http://bootsnipp.com/snippets/featured/bootstrap-3x-contact-form-layout
as a sample, but running into issues.
  -- Bear

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.

Troy

unread,
Jan 16, 2015, 11:27:12 AM1/16/15
to joomla-de...@googlegroups.com
exactly, so how do you "add" the missing info so  the $this->form->getinput statement pulls our changes in also?  like row=5 or class=foobar ?
Bear
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.

To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.


No virus found in this message.
Checked by AVG - www.avg.com

Version: 2015.0.5645 / Virus Database: 4260/8940 - Release Date: 01/16/15


Viper

unread,
Jan 16, 2015, 11:42:37 AM1/16/15
to joomla-de...@googlegroups.com
You should create a xml form definition and add the froms into it. After you must to load the xml form into the model using JModelForm->getForm();

Look at the API docs https://api.joomla.org/cms-3/classes/JModelForm.html

Examples you can view in standard Joomla core component(in backend) like com_content or
simple model JModelForm https://github.com/Globulopolis/kinoarhiv/blob/master/administrator/components/com_kinoarhiv/models/award.php
and appropriate xml definition https://github.com/Globulopolis/kinoarhiv/blob/master/administrator/components/com_kinoarhiv/models/forms/award.xml

Troy

unread,
Jan 16, 2015, 5:07:12 PM1/16/15
to joomla-de...@googlegroups.com
maybe I get it a tiny bit *sigh*...  I looked @ the api https://api.joomla.org/cms-3/classes/JForm.html#method_setFields, and came up with
                    <div class="input-group">
                        <?php $contact_message = $this->form->setFieldAttribute('contact_message','rows','20'); ?>
                        <div><?php echo $this->form->getInput('contact_message'); ?></div>

                        <span class="input-group-addon"><i class="glyphicon glyphicon-ok form-control-feedback"></i></span>
                    </div>
does that look right?  if I want to ADD to the class then I would need
                    <div class="input-group">
                        <?php $contact_message = $this->form->setFieldAttribute('contact_message','rows','20'); ?>
                        <?php $contact_message = $this->form->setFieldAttribute('contact_message','class','foo'); ?>
                        <div><?php echo $this->form->getInput('contact_message'); ?></div>

                        <span class="input-group-addon"><i class="glyphicon glyphicon-ok form-control-feedback"></i></span>
                    </div
Bear
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.

Troy

unread,
Jan 16, 2015, 5:20:06 PM1/16/15
to joomla-de...@googlegroups.com
I still can't figure out the email copy.. it kinda looks right but the box is far too large and captcha looks horrendous
                <?php if ($this->params->get('show_email_copy')) : ?>
                    <div class="form-group">
                        <?php echo $this->form->getLabel('contact_email_copy'); ?>
                        <div class="input-group">
                            <div class="form-control checkbox"><?php echo $this->form->getInput('contact_email_copy'); ?></div>
                        </div>
                    </div>
                <?php endif; ?>
Bear

Troy

unread,
Jan 16, 2015, 6:41:38 PM1/16/15
to joomla-de...@googlegroups.com

Troy

unread,
Jan 17, 2015, 5:04:29 PM1/17/15
to joomla-de...@googlegroups.com
I'm still having a issue where its showing
Contact
Contact Form     image
at the top of the form.  I can't seem to figure out how to turn those on/off and how to show the menu title per some param.
Secondly what does this do?  It's from the staging contact default.php
        <?php if ($this->params->get('presentation_style') == 'plain'):?>
            <?php echo '<h3>' . JText::_('COM_CONTACT_EMAIL_FORM') . '</h3>';  ?>

        <?php endif; ?>

Bear
On 1/16/2015 16:06, Troy wrote:
Reply all
Reply to author
Forward
0 new messages