Support » Plugin: Admin Page Framework » Add Button wo fires own function

  • Hello

    We would like to add a button to initiate an import process.
    Is there a way to do that?
    I.e. when clicked, firing an Ajax call or just firing the desired function and reload the current page/tab?

    Thanks
    Aldo

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author miunosoft

    (@miunosoft)

    Hi,

    Not sure about what you exactly want to do but you can create a link button which reloads its current page.

    
    array( 
        'type'          => 'submit', 
        'value'         => 'This is a test', 
        'href'          => '', 
        'attributes'    => array( 
            'class' => 'button button-secondary unique-class-for-ajax-event', 
        ),     
    )
    

    Then you can add your JS script to trigger your own event assigning to the button, in the above case, using the class selector .unique-class-for-ajax-event.

    Hope this helps.

    Thanks!

    Is there a way to fire just a function instead of submitting the complete form?
    Basically do my own PHP stuff, when the form is submitted?

    There are load and content actions.
    Is there something when the form is processed?

    Plugin Author miunosoft

    (@miunosoft)

    You can use the validation callbacks. In your extended class, add the validate() method.

    Something like this,

    
        public function validate( $aInputs, $aOldInputs, $oAdminPage, $aSubmitInfo ) {
        
            // do your own stuff here
            
            return $aInputs;
        }
    

    the forth parameter may be omitted if the form is not for admin pages such as meta boxes.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.