skizzoweb
Total posts: 20
21 Март 2014 16:30

Hello Sergey, I have a big problem with customizing a submission form. I read your article this here:

http://docs.mintjoomla.com/en/cobalt/custom-templates-form/

Entirely clear, but it does not show the validation if I fail to complete some field. As if I leave the default form appears in the error field is not filled.

You have not explained how to put the errors for the required field in the article. There is only demonstrates how to print the field and label, but not how to put validation.

How can I add this easily? thank you very much

Последние изменения: 24 Март 2014


skizzoweb
Total posts: 20
21 Март 2014 16:31

My phpphpVideo


Гость
22 Март 2014 08:45

please sergey, help me :( skizzoweb


nican VIP
Total posts: 392
22 Март 2014 14:09

today it's saturday, you'll have to wait until monday at least I think Sergey deserves the week-end out of this forum :-)


Sergey
Total posts: 13,748
24 Март 2014 06:13

When I posted that article I assume that you strat form template creation from copying default template.

The example you gave me is all your form or just part you want to show?

Anyway, it looks good to me. I would look into browser console if you have any javascript error.


skizzoweb
Total posts: 20
24 Март 2014 06:50

Thanks for you support Sergey :)

I have done all the steps you mentioned. I duplicated the standard template and created a new template from the base of one present in the template.

I have done all the steps you mentioned. I duplicated the standard template and created a new template from the base of one present in the template.

I wanted to change the part that generates the form, but not dynamically creating it manually, just as you have shown in this guide here:

http://docs.mintjoomla.com/en/cobalt/custom-templates-form/

In the template created / duplicated, I found this line, which was what I was interested in me, including this piece of code:

sorted_fields[0])):?>
                                    sorted_fields[0] as $field_id => $field):?>
                                        <div id="fld-&lt;?php echo $field-&gt;id;?&gt;" class="control-group">">
                                            params->get('core.show_lable') == 1 || $field->params->get('core.show_lable') == 3):?>
                                                <label id="lbl-&lt;?php echo $field-&gt;id;?&gt;" for="">" class="control-label class;?>" >
                                                    params->get('core.icon') && $params->get('tmpl_core.item_icon_fields')):?>
                                                        params->get('core.icon'));  ?>



                                                    required): ?>
                                                        <span class="pull-right" rel="tooltip" data-original-title=""></span>


                                                    description):?>
                                                        span class="pull-right" rel="tooltip" style="cursor: help;"  data-originl-title="translateDescription ? JText::_($field->description) : $field->description), ENT_COMPAT, 'UTF-8');?>">

                                                        </span>


                                                    label; ?>

                                                </label>
                                                params->get('core.label_break'), array(1,3))):?>
                                                    <div style="clear: both;"></div>



                                            <div class="controls &lt;?php if(in_array($field-&gt;params-&gt;get('core.label_break'), array(1,3))) echo '-full'; ?&gt; &lt;?php echo (in_array($field-&gt;params-&gt;get('core.label_break'), array(1,3)) ? ' line-brk' : NULL) ?&gt; &lt;?php echo $field-&gt;fieldclass  ?&gt;">
                                                <div id="field-alert-&lt;?php echo $field-&gt;id?&gt;" class="alert alert-error" style="display:none"></div>
                                                result; ?>
                                            </div>
                                        </div>

                                    sorted_fields[0]);?>

So I decided to delete this entire row to create my custom form, just as you have mentioned. But I have separated the two elements, so instead of:

<?php echo $fields[12]->label.': '.$this->fields[12]->result; ?>

I rendered so

        <div class="myclass">fields[12]->label; ?></div> 
        <div class="myclass2">fields[12]->result; ?></div>

My problem stems from the fact that I do not validate the empty fields that should be mandatory. As if there were no controls in control of them to me. If I leave a required field blank, and hit Save item, nothing happens. It does not save the item but even shows me the error. If I go on, I fill in the name field and then pressing it saves the key item, then I save the article PROPERLY.

I tried to restore the standard template of cobalt, and with that it works perfectly. When a field is not present, he is back on using jquery scroll up, show me the error and shows me where I need to fill in the field.

So I deduce that the solution posted in your guide is fine, but does not include the validation. Can you help me understand how to do?

Thank you Sergey


skizzoweb
Total posts: 20
24 Март 2014 06:53

P.S. The editor has eaten the PHP tag


Sergey
Total posts: 13,748
24 Март 2014 07:25

You have to check that in console. The errors are handled by javascript. I presume there is some JS error.

Or give me link to that page and I'll have a look.

skizzoweb P.S. The editor has eaten the PHP tag

We are working on that. That is Joomla build in HTML filter.


skizzoweb
Total posts: 20
24 Март 2014 09:07

Thanks my friend, Sergey. I solved my problem by inserting this line of code for each field:

PHP

Would advise to update the guide to create a custom form of Cobalt :)

Best regards,

Mirco


Sergey
Total posts: 13,748
24 Март 2014 11:23

Please edit your comment. Line was not saved. If you cannot add it, simply insert it into a file and upload a file.

Работает на Cobalt