facebook

text box value dependant on combobox selection

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #345625 Reply

    julianp4
    Member

    Hi

    Can wanyone help on this one? I have a combobox with 6 different names in and I want each name to bring up a new set of numbers in a separate text box . How do I do this??

    Waiting patiently with fingers crossed..

    Also need to know if its possible to get the app to allow you to browse and insert an image from your photos….

    Jules

    #345628

    Code_A
    Member

    Similar question here with some code on how to set it up viewtopic.php?f=8&t=4937.

    Hopefully this is enough to get you tarted. Post your code if you are having problems getting it to work.

    #345630

    Unknown Author
    Participant

    First link the combobox to the action “Run Javascript”.

    Put some function name in there:

    do_it();

    Then, in your pagename_custom.js file, you need the function:

    function do_it(){
      var n = $('select[name="combobox1"]').val();
      $('#m1-pagename-text1').text(n);
    }
    #345652

    julianp4
    Member

    @1thinchip wrote:

    First link the combobox to the action “Run Javascript”.

    Put some function name in there:

    do_it();

    Then, in your pagename_custom.js file, you need the function:

    function do_it(){
      var n = $('select[name="combobox1"]').val();
      $('#m1-pagename-text1').text(n);
    }

    Thanks guys for your quick responses

    Do I just then follow this with the IF and ELSE IF. Statements?

    #345653

    julianp4
    Member

    Do I use a standard text object in m1 or a text field object?

    Thanks guys

    #345655

    julianp4
    Member

    So kind of working but text is changing to “value2” and “value 3” and not “123.00” and “119.00”
    here is my code

    function airfieldselect() {

    var n = $(‘select[name=”combobox1″]’).val();
    $(‘#m1-test-text1’).text(n);

    if (airfieldselect == ‘value2’){

    $(‘#m1-test-123.0’);
    }

    else if (airfieldselect == ‘value3’){

    $(‘#m1-test-119.275’);
    }

    }

    #345659

    Code_A
    Member

    edit by support-octavio: fixed and merged reply with attachment on this thread.
    Accidentally posted this reply in the wrong thread! Meant to reply to this one viewtopic.php?f=19&t=6673.

    Here is a quick example of dynamically loading and selecting a combobox based on user selection from another combobox.

    Below is the javascript code that is attached the combobox1 that controls combobox2. I have also attached the .mobi file.

    //clear drop down
    $('#m1-FillCombobox-hidden-select-combobox2').empty();
    
    //add new items based on selection
    if ($('#m1-FillCombobox-hidden-select-combobox1').val() == '0'){
        $('#m1-FillCombobox-hidden-select-combobox2').append('<option value="2" label="2">2</option>');
        $('#m1-FillCombobox-hidden-select-combobox2').append('<option value="4" label="4">4</option>');
        $('#m1-FillCombobox-hidden-select-combobox2').append('<option value="6" label="6">6</option>');
    
    }else{
        $('#m1-FillCombobox-hidden-select-combobox2').append('<option value="1" label="1">1</option>');
        $('#m1-FillCombobox-hidden-select-combobox2').append('<option value="3" label="3">3</option>');
        $('#m1-FillCombobox-hidden-select-combobox2').append('<option value="5" label="5">5</option>');    
    
    }
        //update list display
        //$('select[name="combobox2"] option:first').attr('selected','selected');
        $('select[name="combobox2"] option:last').attr('selected','selected');
        $('#m1-FillCombobox-combobox2').text($('select[name="combobox2"] :selected').text());
    
    phoneui.preprocessDOM('FillCombobox');

    Hope this helps.

    Attachments:
    You must be logged in to view attached files.
Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: text box value dependant on combobox selection

You must be logged in to post in the forum log in