add the wordpress jquery form handler to onclick=submit update_post_meta functio (2 posts)

  1. erikshosting
    Posted 3 years ago #

    Hey there,
    I need to use update_post_meta from the front end without reloading the page. How would I implement the wordpress jquery form handler outlined here to do so? my working form function is below:

    //on front end
    <?php display_tentative_approval_buttons(); ?>
    //inside functions.php
    <?php function display_tentative_approval_buttons() {
    	    Global $post;
    	//start the form
    	echo '<form method="post" action="">' . wp_nonce_field('update_wcepsa_postmeta','wcepsa_inventory') . '
    <input type="radio" name="tentativeastatus" value="pre-approved" onClick="submit();" /> Pre-Approved<br />
    <input type="radio" name="tentativeastatus" value="waitlisted" onClick="submit();" /> Waitlisted<br />
    <input type="radio" name="tentativeastatus" value="denied" onClick="submit();" /> Denied <br />
    <input type="hidden" name="post_id" value="'.$post->ID.'" class="tentativebutton" />
    <small>Click to Modify</small>
    //change tentative post status
    if ( isset( $_POST['wcepsa_inventory'] ) && wp_verify_nonce($_POST['wcepsa_inventory'],'update_wcepsa_postmeta') )
        { //if nonce check succeeds.
            global $post;
    	$postid = $_POST['post_id'];
    	$data = $_POST['tentativeastatus'];
  2. RonStrilaeff
    Posted 3 years ago #

    Hi, I'm learning how to do something similar.

    Did you figure out how to implement the .ajaxForm or .ajaxSubmit methods in a wordpress frontend form?

Topic Closed

This topic has been closed to new replies.

About this Topic