Pass a custom value to an editor field

Pass a custom value to an editor field

INTONEINTONE Posts: 153Questions: 58Answers: 6
edited June 2014 in Editor

Hi,

I am trying to take the example in some of the tutorials that create a list of values based on a query to make pre-selection based on a session variable with one value only. The three most important parts that make this work seem to be:

editor code:
{
label: "Created By:",
name: "rights_management.created_by_user_id",
type: "select"
}

and datatables code:

    initComplete: function ( settings, json ) {
        editor.field( 'rights_management.created_by_user_id' ).update( json.users );

    }

the php code:

    if ( !isset($_POST['action']) ) {
     // Get the user who is doing this insert
       $out['users'] = $db->sql('select user_id as value, email as label from users where email = "'.$session->getVar("email").'" ')
      ->fetchAll();
   }

I have applied the filter with an hope that the result would have been reduced to a select with one value. the output looks like this:

     users: {email:null}
     email: null

Any thoughts on how to accomplish this?

This question has an accepted answers - jump to answer

Answers

  • INTONEINTONE Posts: 153Questions: 58Answers: 6

    I don't what I was doing wrong but this is now working as expected.

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    Good to hear it is now working. Did you change anything to get it working - the above code does look okay to me.

    Regards,
    Allan

  • INTONEINTONE Posts: 153Questions: 58Answers: 6

    No I did not change anything for this to work.

This discussion has been closed.