select options

select options

Andreas S.Andreas S. Posts: 169Questions: 58Answers: 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: 8,139Questions: 0Answers: 1,362

    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: 169Questions: 58Answers: 4

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

  • Andreas S.Andreas S. Posts: 169Questions: 58Answers: 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: 51,453Questions: 1Answers: 7,759 Site admin
    edited January 27

    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

Sign In or Register to comment.