Standalone editor not updating

Standalone editor not updating

webvisionwebvision Posts: 10Questions: 7Answers: 0
edited October 2014 in Editor

I'm implementing a standalone editor and it's not updating. Can anyone see the problem?

Javascript:

var Heditor; 
$(document).ready(function() {
    Heditor = new $.fn.dataTable.Editor( {
        ajax: "/report_modules/pf2/act/PF2_Head_Standalone.php?fid=1",
        fields: [ {
                label: "Invoice #:",
                name:  "f_invoice_number"
            }, {
                label: "Invoice Date:",
                name:  "f_date",
                type: "date",
                dateFormat: "yy-mm-dd"
            }, {
                label: "Location:",
                name:  "f_location"
            }, {
                label: "County:",
                name:  "f_county"
            }, {
                label: "State:",
                name:  "f_state"
            }, {
                label: "P.O. Number:",
                name:  "f_po_number"
            }, {
                label: "Operator",
                name: "f_operator"
            }, {
                label: "Contract/Rig",
                name: "f_contract_rig"
            }, {
                label: "Authorized By",
                name: "f_authorized_by"
            }
        ]
    } ); 
    /*$('#edit').on( 'click', function () {
        Heditor
            .buttons( {
                label: "Save",
                fn: function () { this.submit(); }
            } )
            .edit(1);
    } );*/
    $('[data-editor-field]').on( 'click', function (e) {
        Heditor.inline( this, {
            buttons: '_basic'
        } );
    } );
} );

HTML:

<dl>
    <dt>Invoice #:</dt>
    <dd data-editor-field="f_invoice_number">12345</dd>

    <dt>Date:</dt>
    <dd><span data-editor-field="f_date">2014-09-09</span></dd>
    
    <dt>P.O. Number:</dt>
    <dd data-editor-field="f_po_number">54321</dd>
    
    <dt>County:</dt>
    <dd data-editor-field="f_county"></dd>
    
    <dt>State:</dt>
    <dd data-editor-field="f_state"></dd>
    
    <dt>Location:</dt>
    <dd data-editor-field="f_location"></dd>
    
    <dt>Contract/Rig:</dt>
    <dd data-editor-field="f_contract_rig"></dd>
    
    <dt>Authorized By:</dt>
    <dd data-editor-field="f_authorized_by"></dd>
    
    <dd><button id="edit">Edit</button></dd>
</dl>

Server Side:

if ( isset($_POST['action']) && ( $_POST['action'] === 'create' || $_POST['action'] === 'edit' ) ) {
   $_POST['data']['f_id'] = htmlspecialchars($_GET["fid"]);
}

Editor::inst( $db, 'tblPF2_Head' )
    ->fields(
        Field::inst( 'id' )->set( false ),
        Field::inst( 'f_po_number' )->validator( 'Validate::notEmpty' ),
        Field::inst( 'f_operator' ),
        Field::inst( 'f_contract_rig' ),
        Field::inst( 'f_authorized_by' ),
        Field::inst( 'f_location' ),
        Field::inst( 'f_county' ),
        Field::inst( 'f_state' ),
        Field::inst( 'f_date' ) 
            ->validator( 'Validate::dateFormat', array(
                "format"  => Format::DATE_ISO_8601,
                "message" => "Please enter a date in the format yyyy-mm-dd"
            ) )
            ->getFormatter( 'Format::date_sql_to_format', Format::DATE_ISO_8601 )
            ->setFormatter( 'Format::date_format_to_sql', Format::DATE_ISO_8601 )
    )->where( $key = "id", $value = htmlspecialchars($_GET["fid"]), $op = '=' )
    ->process( $_POST )
    ->json();

Answers

This discussion has been closed.