Quantcast
Channel: Adobe Community: Message List - ColdFusion
Viewing all articles
Browse latest Browse all 21760

Re: Query outputting all rows, I just want one.

$
0
0

You have a <button> element that, when clicked, changes your form's 'action' attribute to 'delaction.cfm', but nothing more.  This in no way flags the item as being intended for deletion as you did not change the state of any element to reflect this selection.  After the button you have a hidden field (id) with the value of that id.  As is, this element will always be submitted each time you submit the form.  Also, the button here does not submit the form, it merely changes an attribute value.

 

Then below you have a submit button that performs a submission of the form.

 

Try outputting this on each <li>

 

<input type="checkbox" name="listOfIDsToDelete" value="#id#" disabled />

 

And hide it if need be.  Because it is disabled by default, when the form is submitted, it will not pass its value along.  Then, just use some Javascript to remove/add the disabled attribute to that element when they click on the per-<li> delete button.  When the click on it (to mark it for deletion), JavaScript can turn off the 'disabled' attribute (and vice-versa)

 

That way, when you hit the submit button, only non-disabled fields will submit, and if there is more than 1 <li> marked for deletion, the FORM.listOfIDsToDelete will contain a comma-delimited list of IDs.


Viewing all articles
Browse latest Browse all 21760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>