• Resolved martvanderkruis

    (@martvanderkruis)


    Hey,

    In my pod (form on frontend) I have checkboxes which, when checked, creates an item in another pod through pods_api_post_save_pod_item. I have build my code like this:

    $non_actief = $paard_pod->field('non-actief'); //checkboxes
    $add_dossier = $paard_pod->field('add_dossier');
    $verwijderen = $paard_pod->field('verwijderen');
    		
    if($non_actief) {
    	delete_post_meta($id, 'groep');
    	
    	if($add_dossier) {
    		$data = array(
    			'paard' => $id,
    			'author' => $user, // User ID for relationship field
    			'opmerkingen' => 'Non-actief gezet',
    			'verschijndatum' => date('d-m-Y')
    		);
    		$dossier_pod->add( $data );
    				
    		$paard_data = array(
    			'add_dossier' => false
    		);
    		$paard_pod->save($paard_data, $id);
    	}
    }elseif($verwijderen){
    	$paard_verwijderen->delete($id);
    }else {
    	if($add_dossier) {
    		$data = array(
    			'paard' => $id,
    			'author' => $user, // User ID for relationship field
    			'opmerkingen' => 'Terug actief gezet',
    			'verschijndatum' => date('d-m-Y')
    		);
    		$dossier_pod->add( $data );
    				
    		$paard_data = array(
    			'add_dossier' => false
    		);
    		$paard_pod->save($paard_data, $id);
    	}
    }

    It all works fine but when I check the box for ‘non-actief’ it shows an popup saying ‘unable to handle request’ (wp-admin/admin-ajax.php?pods_ajax=1&action=pods_admin 500 error) but the code has run and worked! It also only happens with that particular checkbox. The others work fine.

    I can’t seem to find what happens here? Could someone help me?

    Thanks,
    Mart

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Paul Clark

    (@pdclark)

    Hi Mart,

    The code snippet looks fine to me, other than $id, $user, and $paard_pod being presumably defined in another part of your code.

    Is there a specific error with a line number being output in your server logs? This can sometimes provide more specific information than a generic error 500.

    Sometimes mod_security can cause 500 errors when POSTing to admin-ajax.php —?this would be something to check with your hosting support.

    Plugin Author Jory Hogeveen

    (@keraweb)

    Closing topic due to no reply, feel free to reopen if you still need help!

    Cheers, Jory

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘unable to handle request on form submission’ is closed to new replies.