• Resolved llucssll

    (@llucssll)


    Hello,

    I’ve noticed that in various sites I work on the ‘first_as_label’ attribute isn’t working. The select field works just fine, but the first option doesn’t get tagged as disabled. I remember it working previously on other sites I worked on, but it currently doesn’t work.

    This the configuration:

    This is what I get on screen:

    I’ve checked two diferent sites, one uses CF7 version 5.8 (latest version at time of writting,) and the other one uses version 5.7.6 and both have the same issue.

    This has an effect on the styling of the form so I look forward to your replies to solve this issue

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Where can we see the website in question?

    Thread Starter llucssll

    (@llucssll)

    Hi,

    This site in question is still in development so its not online yet. I’ve got another site with the same issue (https://consultoriabosch.com/contacte-consultoria-bosch/).

    This site’s languages are ‘Catalan’ and ‘Spanish’, in case you want to translate something to understand the contents.

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    In which field do you have the problem?

    Thread Starter llucssll

    (@llucssll)

    Hi,

    This problem ocurs with the ‘select’ field, as stated in my original question, its the ‘firs_as_label’ attribute that doesn’t appear to work

    Thanks

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    The only select field on the linked page seems to be working as configured.

    Thread Starter llucssll

    (@llucssll)

    Shouldn’t the ‘first_as_label’ attribute set the first ‘<option>’ as disabled? So it becomes the label and not a selectable option.

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    No. The first_as_label option makes the first option value empty.

    Thread Starter llucssll

    (@llucssll)

    Hi, shoudn’t that be the include_blank attribute? As stated in the documentation, it bears closest resemblance to what you described in the previous answer.

    If tried changing the ‘first_as_label’ attribute for the ‘include_blank’ and it seems to work just fine, it adds a new option named “–Choose an option–“. But replacing it for the ‘first_as_label’ attribute doesn’t do anything, it shows the same behaviour if you add it or not.

    So im just left with the conclusion that ‘first_as_label’ doesn’t work anymore.

    Thanks,

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    first_as_label and include_blank are different options. The first_as_label option is working correctly on the site.

    1- Replacing the?include_blank?with?first_as_label?
    2- use this script to disable first option

    (function ($) {
       'use strict';
       $(document).ready(function () {
           var $select = $('.wpcf7-select');
           $select.each(function(e){
             var first_option = $(this).find('option').first();
             if(first_option.attr('value') == ''){
               first_option.attr('disabled', true);
             }
         })
      });
    })(jQuery)

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘first_as_label not working’ is closed to new replies.