Forum Replies Created

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • in reply to: Set default palettes in colorpicker field #7405
    mattkl
    Participant

    Ok. Outlook ate your response and spit it out kind of wonky, and you have it marked as private here, so I cannot see it the way you intended. From what I can decode in the email, I think setting the value is what you’re proposing. That’s ok, if you only want a single default color and if you’re not using the color picker in an add-more. In add-more fields, I have not been able to get default values to work. At all. Plus, I need several default colors available for my client. So, setting the default palettes is the best solution – for me, anyway.

    in reply to: Conditional Updates based on Select option #7337
    mattkl
    Participant

    OMG. Nevermind. The update values needed quotes. How did I miss that? KMN.

    in reply to: add-more sortable on iOS #7327
    mattkl
    Participant

    Ok. I have a (temporary) fix. An ugly fix.

    First, I determine if the user is on a mobile device (the list is not comprehensive) in the PHP above the Piklist field definitions in my metabox file and use that to set a boolean flag…

    $draggable = TRUE;
    		
    if( stristr($_SERVER['HTTP_USER_AGENT'],'ipad') ) {
        $draggable = FALSE;
    } else if( stristr($_SERVER['HTTP_USER_AGENT'],'iphone') || strstr($_SERVER['HTTP_USER_AGENT'],'iphone') ) {
        $draggable = FALSE;
    } else if( stristr($_SERVER['HTTP_USER_AGENT'],'blackberry') ) {
        $draggable = FALSE;
    } else if( stristr($_SERVER['HTTP_USER_AGENT'],'android') ) {
        $draggable = FALSE;
    }
    

    Then, for the add-more definitions, I altered the sortable parameter:
    ,'sortable' => $draggable

    At the moment, this accomplishes the goal of keeping the sortable/dragable functionality for desktop and laptop devices, but disables it and allows for add-more field editing on mobile devices.

    in reply to: add-more confirm before delete #7138
    mattkl
    Participant

    Provided that the class of the remove elements is always ‘piklist-addmore-remove’, then this binds to all existing occurrences of the removal buttons, as well as any new occurrences of the removal buttons.

    Further, it acts on all removal buttons in the page, regardless of which meta-box they are in. That may or may not be what others will want. In those cases, you would specify the meta-box ID or some container element to restrict this being added to only that specific group.

    in reply to: add-more confirm before delete #7136
    mattkl
    Participant

    Actually, you don’t need the jQuery(document).ready part…

    jQuery(document).on("click", ".piklist-addmore-remove", function (event) {
        return confirm("Are you sure you want to remove this item/section?");
    });
    in reply to: add-more confirm before delete #7135
    mattkl
    Participant

    Ok. Took me a beat to figure this out, since jquery is already in the admin section. You just have to replace $ with jQuery.

    Here is what I am using. It works (so far) for me.

    jQuery(document).ready(function () {
            jQuery(document).on("click", ".piklist-addmore-remove", function (event) {
                return confirm("Are you sure you want to remove this item/section?");
            });
    
        });
    in reply to: add-more confirm before delete #7133
    mattkl
    Participant

    I think that would work. Now I just have to figure out how to load jquery to the admin (post edit) area without breaking the meta-box.

Viewing 7 posts - 1 through 7 (of 7 total)