DMXzone App Connect Support Product Page

Solved

Can't delete records. Record ID showing as "[object Object]"

Reported 07 Nov 2018 11:38:02
1
has this problem
07 Nov 2018 11:38:02 Bruce Wilkie posted:
Hi there

I've set up a delete record page following the video at www.youtube.com/watch?v=iwA_VkPEx2c

But it's not deleting the record when I click the button. I've changed the hidden id field to a text field and it's not showing the record id as its value. It's showing "[object Object]" instead.

Code for page:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script type="text/javascript" src="../dmxAppConnect/dmxAppConnect.js"></script>
</head>

<body id="deletetest" is="dmx-app">
<dmx-serverconnect id="serverconnectListPhotos" url="../dmxConnect/api/Adminarea/AdminSelectNewsPics.php" dmx-param:newsid="query.newsid"></dmx-serverconnect>
<h1>Test</h1>
<table width="100%" border="1">

<tbody>
<tr dmx-repeat:repeatphotos="serverconnectListPhotos.data.querySelectNewsPics">
<td>{{news_pic_file}}</td>
<td><form action="../dmxConnect/api/Adminarea/AdminNewPicDelete.php" method="post" name="form1" id="form1" is="dmx-serverconnect-form" dmx-on:success="serverconnectListPhotos.load({newsid: query.newsid})">
<input name="news_pic_id" type="text" id="news_pic_id" dmx-bind:value="news_pic_id">
<input type="submit" name="submit" id="submit" value="Submit">
</form></td>
</tr>
</tbody>
</table>
</body>
</html>

Screenshot of page: prntscr.com/lff1k9


Any ideas what I'm doing wrong here?

Bruce

Replies

Replied 07 Nov 2018 13:45:33
07 Nov 2018 13:45:33 Teodor Kuduschiev replied:
That's because the dynamic binding name is the same as the static id/name used:

<input name="news_pic_id" type="text" id="news_pic_id" dmx-bind:value="news_pic_id">

In this case change the static name and id to be different than any dynamic binding. They should not be equal to: news_pic_id
Replied 07 Nov 2018 14:42:14
07 Nov 2018 14:42:14 Bruce Wilkie replied:
Thanks Teodor, that's fixed it

Bruce

Reply to this topic