Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
Hello All!

I am having a relational field editable (with has='one').
Am unable to save its value in the DBF i am using.

Editable Field
Code: Select all
<cms:editable name="ncoal_cmdt" label="Commodity" type="relation" masterpage='ncoal-commodity.php' has="one" order="1" />


where ncoal-commodity.php is a template which has values saved in k_page_title and no other editable region. The values from this are being fetched to the relation.

On the front end the following code is implemented, purposefully, so as to make the chained dropdown work.
Code: Select all
<cms:hide>
    <cms:input name="ncoal_cmdt" type="bound" />
</cms:hide>
<select name="f_ncoal_cmdt" id="meal" class="gxcpl-input-text" onChange="changeCat(this.value);" style="width: 100%;">
    <option value="" disabled selected>Select</option>
    <cms:pages masterpage='ncoal-commodity.php'>
   <option id="<cms:show k_page_id />" value="<cms:show k_page_title />"><cms:show k_page_title /></option>
    </cms:pages>
</select>


When I select the value from the dropdown and hit save, the DBF saves but the selected value does not save.

I tried adding the editable name to the db_persist_form block, still not saving, code:
Code: Select all
<cms:if k_success >
    <cms:db_persist_form
        _invalidate_cache='0'
        _auto_title = '1'
   ncoal_cmdt= "<cms:pages masterpage='ncoal-commodity.php' page_name='<cms:show frm_ncoal_cmdt />'><cms:show k_page_id /></cms:pages>"
    />
    <cms:if k_success >
   <cms:set_flash name='submit_success' value='1' />
   <cms:redirect url="<cms:route_link 'create_ncoal' />" />
    </cms:if>
</cms:if>

Though I am removed this above code.

Regards!
Image
where innovation meets technology
Solving this trouble is very simple (you made noob mistakes), but make you see them is more interesting for me. If it is the same for you then do this -
1. Remove the redirect line <cmsz:redirect url="<cms:route_link 'create_ncoal' />" />
2. Make sure the form doesn't have method='post'
3. Submit the form and pay attention to the submitted inputs and values in the url bar.

As a side note, send id directly instead of going per rectum ad astra with k_page_title .
2 posts Page 1 of 1
cron