select options

select options

Andreas S.Andreas S. Posts: 207Questions: 73Answers: 4

I have two select inputs with same options, but different usages. For example the nationality of a person and the nation of his residence. At the moment the server send the options twice with different naming. Is it possible that both select fields (different names) take the same options that i send in the json?

Andreas

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    That would be possible. You could have them declared as empt select in the initialisation, then in the preOpen you could add those values to the select with e-ai field().udate() if they haven't been done so already,

    Colin

  • Andreas S.Andreas S. Posts: 207Questions: 73Answers: 4

    Did not understand how can i get those data
    from the json file?

  • Andreas S.Andreas S. Posts: 207Questions: 73Answers: 4
    Answer ✓

    I have found with try and error this:

    aedit.on( 'preOpen open', function( e, mode, action ) {
            if( 'preOpen' == e.type ) {
                aedit.field('znation').update( paathlete.context[0].json.options.nation );
            }
            if( 'open' == e.type ) {
                $( '#none' ).removeClass( 'd-none' );
            }
        } );
    

    but the need 3 seconds before the editor open with one of this update. if i add a second select with this code the time grow up to 5 seconds.

    Andreas

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    edited January 2020

    Sounds like you might have a lot of options. You might want to consider using Select2 or similar to show and filter just a subset of options.

    Allan

This discussion has been closed.