Skip to content

Instantly share code, notes, and snippets.

@tabacitu
Created January 9, 2023 06:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tabacitu/3c1de6b48c5b9fa735f23ea0ec46292d to your computer and use it in GitHub Desktop.
Save tabacitu/3c1de6b48c5b9fa735f23ea0ec46292d to your computer and use it in GitHub Desktop.
Example for using the CrudField JS API
crud.field('owners').subfield('owner_id').onChange(function(subfield) {
// TODO: do an AJAX call to an API you control;
// the easiest would be to make a call to the FetchOperation on the same CrudController
let ownerId = subfield.value;
let theValueYouWantToSet = 'something';
crud.field('owners').subfield('nick', subfield.rowNumber).input.value = theValueYouWantToSet;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment