This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

netsmertia
netsmertia

I am trying to implement two part form at backend where user will provide some key in input field VideoId and based on provided key some api call will be fired (by click on fetch button If I can put or on field focus out event). The result of api call will be the value for other fields on form and also editable (thumbnail url, Title, View Count etc).

Basically it is a autofill based on some api request. I can do this in beforeSave event but I need to show the received data to user before it get saved so He can change if required. Any direction to look?

Last updated

Adrien - ACTE Solutions
Adrien - ACTE Solutions

Hello,

  1. You could use accessors for each thumbnail url, Title, View Count when fields are empty.
function getTitleAttribute($value){
  if(!$value){ <!-- api call --> }
  else{ return $value; }
}

(https://octobercms.com/docs/database/mutators#accessors-and-mutators)

  1. The fetch button function could refresh the form fields.

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.