Support

Account

Home Forums Backend Issues (wp-admin) update "instructions" after load if fields are filled out?

Solved

update "instructions" after load if fields are filled out?

  • update “instructions” for a field after load if certain fields are filled out?

    OR

    update message field.

    What im trying to do is.
    If a certain field in the admin post area is filled out i want to take that data and present it as a external link under the instruction text.

  • I think you could do this with some custom JavaScript loaded on the admin page via admin_enqueue_scripts.

    Say your field is named “my_field”, you could try something like this (using jQuery):

    
    if ( $("#acf-field-my_field").val() ) {
     $("#acf-my_field .label").append("My new text here");
    }
    

    Haven’t tested it but that’s where I’d start.

  • Thanks yeah i solved it that way….

    function my_head_input()
    {
        ?>
        <style type="text/css">
        .field {width:50%; display:inline-block; vertical-align: top; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; padding:10px !important;}
        .field_type-repeater,.field_type-true_false {width:100%; padding: 10px 0!important;}
    
        </style>
    
        <script type="text/javascript">
        jQuery(document).ready(function(){
        "use strict";
            var isbn = jQuery('#acf-field-isbn').val();
            if (isbn) {
                jQuery('#acf-isbn p').append('<br><a href="http://www.bokrondellen.se/'+isbn+'.aspx" target="_blank"> Boklänk till Bokrondellen '+isbn+'</a>');
            }
        });
        </script>
        <?php
    }
    
    add_action('acf/input/admin_head', 'my_head_input');
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘update "instructions" after load if fields are filled out?’ is closed to new replies.