jean-claude_bac
I'm new here

Set Medium using FormData?

Jump to solution

FirstSpirit API version: 4.2.454

Old style:

Dataset dataSet = csVideo.getDataset(entityVideo);

Data data = dataSet.getData();

FileEditorValue editorFile = (FileEditorValue) data.get("cs_file").getEditor();

editorFile.get(language).setMedium(mediaVideo);

Since getData is deprecated, there probably is a way to do that using:

Dataset dataSet = csVideo.getDataset(entityVideo);

FormData videoFormData = videoDataSet.getFormData();

fileFormField.set(mediaVideo); !! does not work

The question is how do I do that?

0 Kudos
10 Replies

Well, a Media is no BinaryMedium ... it works analogue to using the editorvalue in your first post:

FormField<?> fileFormField = videoFormData.get(language,"cs_file");

BinaryMedium container = (BinaryMedium) fileFormField.get();

container.setMedium(mediaVideo);

fileFormField.set(container);

...

Stefan.

0 Kudos