I’m building a function where a user can approve an another users entry (basically a manager can approve an expense form).
I’m currently using statuses and this code worked fine pre 2.6
{exp:safecracker channel="expense_report" return="manager/report_approved" include_jquery="no" entry_id="{segment_3}" preserve_checkboxes="yes"}
<input type="hidden" name="title" id="title" value="{title}" size="50" maxlength="100" >
<input type="hidden" name="status" id="status" value="Approved">
<button type="submit" class="btn btn-info">Approve</button>
{/exp:safecracker}However I’m now using the new fancy relationships and it throws a coupple of php warnings and also remove all relationships.
I assume it’s ok to partially edit an entry using safecracker without the need to include the whole form. It worked fine before and on other places sans relationships
If I include the code for the relationship it works, but it does NOT work if I hide the checkboxes either with css display:none or type=“hidden”.
{custom_fields}
{if relationship}
{options}
<input type="hidden" name="{field_name}[sort][]" value="{option_order}" >
<input type="checkbox" name="{field_name}[data][]" value="{option_value}" class="" {checked}>
{/options}
{/if}
{/custom_fields}In the best of worlds safecracker would preserve the relationships through preserve_checkboxes=“yes” or similar. In the meantime maybe someone has a leaner solution?