Making Add New option appear first!

Hi @GSH,
You can do this with the following JS:

If you want to only apply it to one particular field:

$(document).on('knack-view-render.any', function(event, view, record) {

  const connectionFieldKey = 'field_xx'; // Replace field_xx with your connection field key
  const $inputDiv = $(`#${view.key} #kn-input-${connectionFieldKey}`);
  const $inputControl = $inputDiv.children('.control');
  const $addOptionLink = $inputControl.children('.kn-add-option');
  $addOptionLink.insertBefore($inputControl);

});

If you want to apply it for all connection fields:

$(document).on('knack-view-render.any', function(event, view, record) {

  $(`#${view.key} .kn-input-connection`).each(function() {

    const $inputControl = $(this).children('.control');
    const $addOptionLink = $inputControl.children('.kn-add-option');
    $addOptionLink.insertBefore($inputControl);

  });

});

The result should look something like this:
image

1 Like