Auto Save Edit Grid

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
juniorpinto
User
Posts: 48

Auto Save Edit Grid

Post by juniorpinto »

I'm making a checklist and I need the information to be saved in the database as I tick the radio button. I believe I should do it with Ajax. Can anyone guide me? Thanks


arbei
User
Posts: 9284

Post by arbei »

Yes, you can, you may read Create Your Own API Action.


juniorpinto
User
Posts: 48

Post by juniorpinto »

In: Server Events / Global / All Pages / Api_Action, i have create a script....

// API Action event
function Api_Action($app){

    $app->get('/CheckList/{Relatorio}/{Questao}/{Valor}', function ($request, $response, $args){

        $Relatorio = $args["Relatorio"];
        $Questao = $args["Questao"];
        $ValorClicado = $args["Valor"];

        $myResult = ExecuteStatement("UPDATE tb_itensavaliados SET Resultado='{$ValorClicado}' WHERE CodRel= {$Relatorio} and CodQuetoes= {$Questao}");

        return $response;

    });
}

I thought of calling it in Edit Tag Client side events... but I don't know how... the path is: /api/CheckList/1/9/BA


juniorpinto
User
Posts: 48

Post by juniorpinto »

sorted out!!!!
to call the api I put it in Edit Tag / Client side events:

{ // keys = event types, values = handler functions
	"change": function(e) {
		var $parameter1 = "xxxxx";
                var $parameter2 = "xxxxx";
                var $parameter3 = "xxxxx";

fetch("./api/CheckList/" + $parameter1 + "/" + $parameter2 + "/" + $parameter3);

	}
}

Post Reply