I am trying to replace some of my forms with x-editable and am struggling even getting to post to work.
The element is
<a href="#" id="xformed" data-type="text" data-id="<?php echo $club->data()->id; ?>" data-table="clubs" data-field="formed" data-title="Enter Year Formed">
Formed
</a>
and it populates correct on the page....
<a href="#" id="xformed" data-type="text" data-id="1065" data-table="clubs" data-field="formed" data-title="Enter Year Formed" class="editable editable-click">
Formed
</a>
and at the bottom of the page I have...
<script src="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/js/bootstrap-editable.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#xformed').editable({
url: 'testclubpost.php'
});
});
</script>
Up to this point, everything works fine, when clicked the input pop-up appears and when you enter a value it changes in the a tag.
The problem lies in the posting to testclubpost.php. What I want, eventually, is to return a json_encode after inserting or updating the database but it does not seem to be even reaching the page.
I have stripped teastclubpost.php right down to just holding a hard-coded update query
<?php
require_once 'core/init.php';
$update = DB::getInstance()->update('clubs', 'id', 1065, array(
'formed' => '888'));
?>
If I submit the x-editable form, the value on the page updates but nothing happens in the database. If I navigate directly to testclubpost.php, the update works. To me, this seems as though, for some reason, x-editable is not even sending it to the page. Both files are in the same directory (root) so am completely puzzled by this.
Any ideas as to why it is not working would be gratefully received.
Regards Steve
For all submit, it requires "pk", "name" and "value"
You can try the following.
<a href="#" id="xformed" data-type="text" data-pk="1065" data-table="clubs" data-field="formed" data-title="Enter Year Formed" data-name="whateveru_name" class="editable editable-click">
Note the data-pk and data-name field. Value will be the new value you submitted.
Missing any of the above will not submit the form.