Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hi guys,

I have a little question, is it possible to create the next solution.
The "Address:" field needs to be generated with the editables above (Street, Housenumber, Postalcode and City)

And I also want to say again how great couchcms is, and especially the community that belongs to it.

Code: Select all
<cms:editable name='res_row1' type='row'>
            <cms:editable name='res_straat' label='Street' type='text' class='col-md-6' />
            <cms:editable name='res_nummer' label='Housenumber' type='text' class='col-md-1' />
            <cms:editable name='res_postcode' label='Postalcode' type='text' class='col-md-2' />
            <cms:editable name='res_gemeente' label='City' type='text' class='col-md-3' />
</cms:editable>
<cms:editable name='res_address' label='Address:' type='text'/>


Image
Hi,

If the 'res_address' field is supposed to *always* show a consolidation of the first four fields, then perhaps you don't even need to have that field - you can always generate its contents (on the front-end, e.g.) by showing the contents of the constituent fields in the desired format.

If, however, the idea is that *by default* the content of 'res_address' would be derived from the other fields but the user can modify it to anything then you can use the following -

Place a <cms:config_form_view> block in your template as follows -
Code: Select all
<cms:config_form_view>
    <cms:persist
        res_address="<cms:if frm_res_address=''><cms:show frm_res_straat /> <cms:show frm_res_nummer />, <cms:show frm_res_postcode /> <cms:show frm_res_gemeente /><cms:else/><cms:show frm_res_address /></cms:if>"
    />
</cms:config_form_view>

The code above checks if the address is empty - if yes, it auto-populates it with contents of the other fields; if no, it leaves its contents untouched.

If you need it, the details of this technique (and more) can be found in the following post -
viewtopic.php?f=5&t=10241

Hope this helps.
@KK,

You are a hero! This works perfect!
I love the great support of you guys.

Thanks
Bert
You are welcome :)
4 posts Page 1 of 1
cron