hey,
I have a view of cpt "orders" with a table.
Basically the table has about 8 cells in it. each <td> has a form which updates a single cred field from the order (I created a different cred for each field).
I created a button at the end of the table to update all forms in one go, with the code:
$(".update-all").click(function() {
$(this).closest('tr').find('.all-submit').trigger('click');
});
But this creates quite an extreme server load, as each table row has to load 8 different cred forms - and with many table rows, this is very heavy.
So I tried to combine all fields into a single cred form, and with a bit of CSS and HTML tricks - make each appear in a seperate <td>.
My view shows this:
<td>[cred_form form='all-admin-order-edits']</td>
and the cred forms shows this:
[credform]
[cred_field field='form_messages' class='alert alert-warning']
[cred_field field="order-status" force_type="field" class="form-control" output="bootstrap"]</td>
<td>[cred_field field='intended-delivery-date' force_type='field' class='form-control' output='bootstrap']</td>
<td>[cred_field field="actual-delivery-date" force_type="field" class="form-control" output="bootstrap"]</td>
<td>[cred_field field="send-abroad-date" force_type="field" class="form-control" output="bootstrap"]</td>
<td>[cred_field field="delivery-number" force_type="field" class="form-control" output="bootstrap"]</td>
<td>[cred_field field="return-date" force_type="field" class="form-control" output="bootstrap"]</td>
<td>[cred_field field="final-status" force_type="field" class="form-control" output="bootstrap"]</td>
<td><div class="edit-note">[types field='general-notes'][/types]</div>
<div class="pop-note">
<div class="note-form">
<div class="note-container">
<div class="closeform"><i class="far fa-times-circle"></i></div>
[cred_field field="general-notes" force_type="field" class="form-control" output="bootstrap"]
[cred_field field='form_submit' output='bootstrap' value='עדכון הערה' class='btn btn-primary btn-lg']
</div>
</div>
</div>
[/credform]
you can see the there's a closing </td> after the first editable field, and an open <td> at the beginning of the last editable field, without closing it, thus creating in combination with the view:
<td>
[credform]
[cred_field field='form_messages' class='alert alert-warning']
[cred_field field="order-status" force_type="field" class="form-control" output="bootstrap"]</td>
<td>[cred_field field='intended-delivery-date' force_type='field' class='form-control' output='bootstrap']</td>
<td>[cred_field field="actual-delivery-date" force_type="field" class="form-control" output="bootstrap"]</td>
<td>[cred_field field="send-abroad-date" force_type="field" class="form-control" output="bootstrap"]</td>
<td>[cred_field field="delivery-number" force_type="field" class="form-control" output="bootstrap"]</td>
<td>[cred_field field="return-date" force_type="field" class="form-control" output="bootstrap"]</td>
<td>[cred_field field="final-status" force_type="field" class="form-control" output="bootstrap"]</td>
<td><div class="edit-note">[types field='general-notes'][/types]</div>
<div class="pop-note">
<div class="note-form">
<div class="note-container">
<div class="closeform"><i class="far fa-times-circle"></i></div>
[cred_field field="general-notes" force_type="field" class="form-control" output="bootstrap"]
[cred_field field='form_submit' output='bootstrap' value='עדכון הערה' class='btn btn-primary btn-lg']
</div>
</div>
</div>
[/credform]
</td>
the html work fine, and all regular fields work fine - but the date field act strangely: it's missing the ".ui-datepicker-trigger" image, hence doesn't popup the calendar and I can't edit anything.
I tried manually inserting this class to the cred field - but that still did nothing.
Is there anyway around this?
thanks!
Ido