• Resolved tsubakuma

    (@tsubakuma)


    Hello.

    I am creating a quote form that allows the user to select a product (Product A, Product B, Product C…) from a dropdown.
    However, I don’t want users to create duplicate quotes for the same product.

    When users click the button to add a row, for example, product A that was selected once in the past is “cannot be selected (product A is in the pull-down but cannot be selected)” or “not displayed (product A is not displayed in the pull-down )” can be set?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @tsubakuma

    The plugin does not include a specific feature for this case, but you can emulate it from the form.

    I’ll assume there are three dropdown fields in the form: fieldname1, fieldname2, and fieldname3. You can insert an “HTML Content” field in the form with the following piece of code as its content:

    
    <script>
    jQuery(document).on('change', '[id*="fieldname1_"], [id*="fieldname2_"], [id*="fieldname3_"]', function(){
    let e = jQuery(this), v = e.val();
    
    jQuery('[id*="fieldname1_"], [id*="fieldname2_"], [id*="fieldname3_"]').each(function(){ if(this != e[0]) jQuery('option[value="'+v+'"]', this).prop('disabled', true);});
    
    });
    </script>

    Note it is a simple example of the process. If you need a more complex process with other validations or removing the items from the list instead of deactivating them, you can request a custom coding service directly on the plugin’s website: contact us

    Best regards.

    Thread Starter tsubakuma

    (@tsubakuma)

    codepeople san

    Hello.
    A little time has passed.

    The method you taught me now works as desired!
    Thank you for always providing appropriate advice.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to prevent duplicate selection of items in the pull-down’ is closed to new replies.