1

i have a very advanced question. I'm building a website where multiple administrators need to edit content. Because of the relationships between these content items and the fact that i want the flexibility to add some tricks in the future i'm using safecracker as main means for adding content.

This way the editors have a good overview that the content they add is in te right place (relationship to other items).

I have one channel setup for adding VIDEOS and each video has a relationship with 1 event and 1 speaker (other channels).I want the title of each video to be "NAME EVENT - NAME SPEAKER".

SOLUTION WHEN USING THE RELATIONSHIP FIELD

When i use the relationship field and give SafeCracker the folowing parameter

dynamic_title="[name_event_field] - [name_speaker_field]"

It stores the video entry with the entry_ids as title. And example title would be "4 - 10" where 4 and 10 are the entry numbers of the selected event and speaker. I solved this by adding a hidden TITLE field and running the following JS.

$("select[name=video_sui_editie]").change(function () {
    var str = $("select[name=video_sui_editie] option:selected").text() + " - " + $("select[name=video_spreker] option:selected").text();
    $("#title").val(str);
})

Dirty but works like a charm.

PROBLEM

The relationship field isn't as handy to use as playa and since I would really like to use PLAYA while building the site i'm kinda stuck. The JS interface playa creates is pretty complex and i can't seem to find a point i can hook onto like the piece of JS i used before.

When I give SafeCracker the following parameter

dynamic_title="[name_of_playa_event_field] - [name_of_playa_speaker_field]"

The title of the stored entry gets is "[name_of_playa_event_field] - [name_of_playa_speaker_field]". So playa and the dynamic_title parameter of SafeCracker are not compatible.

Question

Does anyone have a way to use the value of the selected playa field as title when adding an entry to ExpressionEngine via SafeCracker?

2 Answers 2

0

Your easiest route here will be to use Title Master. It can automatically populate the title field with Playa fields, and has the bonus of working with both Safecracker and in the control panel.

Just configure the module for your Videos channel and you're done. (You may have to pass a dummy title to Safecracker via a hidden input so it[asses initial validation.)

0

The USE of TITLE MASTER (http://devot-ee.com/add-ons/title-master) solved this problem. I really like this add-on, it makes using safecracker while maintaining nice and consistant title's and url's a breeze.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.