Standalone error
Standalone error
wouter
Posts: 22Questions: 7Answers: 0
He Guys,
I'm trying to create a stand alone form. I've managed to load the form and submit the value. It actually changes in the database but after submitting the value in the textbox changes to to following, and it no longer works:
<div class="DTE DTE_Inline">
<div class="DTE_Inline_Field">
<div class="DTE_Field DTE_Field_Type_text DTE_Field_Name_projects.title">
<label data-dte-e="label" class="DTE_Label" for="DTE_Field_projects.title">
<div data-dte-e="msg-label" class="DTE_Label_Info"></div>
</label>
<div data-dte-e="input" class="DTE_Field_Input">
<div data-dte-e="input-control" class="DTE_Field_InputControl" style="display: block;"><input id="DTE_Field_projects-title" type="text" data-com.agilebits.onepassword.user-edited="yes"></div>
<div data-dte-e="multi-value" class="multi-value" style="display: none;">Multiple values<span data-dte-e="multi-info" class="multi-info" style="display: none;">The selected items contain different values for this input. To edit and set all items for this input to the same value, click or tap here, otherwise they will retain their individual values.</span></div>
<div data-dte-e="msg-multi" class="multi-restore" style="display: none;">Undo changes</div>
<div data-dte-e="msg-error" class="DTE_Field_Error" style="display: none;"></div>
<div data-dte-e="msg-message" class="DTE_Field_Message" style="display: none;"></div>
<div data-dte-e="msg-info" class="DTE_Field_Info"></div>
</div>
</div>
</div>
<div class="DTE_Inline_Buttons">
<div data-dte-e="form_buttons" class="DTE_Form_Buttons"><button class="btn" tabindex="0">Update</button></div>
</div>
</div>
I can't figure out what this means. Here's the js i'm using:
(function($){
var editor;
$(document).ready(function() {
// editor
editor = new $.fn.dataTable.Editor( {
ajax: 'php/table.projects.php',
fields: [
{ "name": "projects.title" },
{ "name": "projects.product" },
]
});
// initial data
$.ajax( {
url: 'php/edit.projects.php',
dataType: 'json',
type: "post",
data : { id : 456 },
success: function ( json ) {
$( ".product" ).text( json.data[0].product );
$( ".title" ).text( json.data[0].title );
}
} );
// open editor on click
$('[data-editor-field]').on( 'click', function (e) {
editor.inline( this, { buttons: '_basic' });
});
});
}(jQuery));
and the html:
<body class="dataTables">
<div class="container" data-editor-id="456">
<table>
<tr>
<td>product</td>
<td><div class="product" data-editor-field="projects.product">-</div></td>
</tr>
<tr>
<td>title</td>
<td><div class="title" data-editor-field="projects.title">-</div></td>
</tr>
</table>
</div>
</body>
and the serverside php:
// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'projects', 'id' )
->fields(
Field::inst( 'product' ),
Field::inst( 'title' )
)
->where( 'id', $_POST['id'],'=')
->process( $_POST )
->json();
Any help would be very much appreciated!!
thanks! wouter
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Hi,
Are you able to give me a link to the page showing the issue so I can debug the problem please? I don't immediately see what would be causing the issue from the above code.
Thanks,
Allan
He Allan,
Thank you for your reply! Here's a link: http://goo.gl/r1dIth
it took me a day, but i figured it out. ashamed to say it's all been caused a wrong data-editor-id. I forgot the row_ part... so, if anyone else runs into this:
wrong:
<div class="container" data-editor-id="456">
good:
<div class="container" data-editor-id="row_456">
Hi,
Thanks for posting back and apologies I didn't get a chance to look into it yesterday. Good to hear you've got it working now!
Allan