0
Checkbox comparisons
Participant
,
/t5/coldfusion-discussions/checkbox-comparisons/td-p/197352
Jul 17, 2008
Jul 17, 2008
Copy link to clipboard
Copied
I solved my previous post, but this post is somewhat related,
so I need to post again, for help.
My form displays mulitple line items and I add a checkbox next to each. If checked, that line is deleted. Here is my checkbox : <cfinput type="checkbox" name="del/#urdn_number#/#urdn_line_item#" value="Yes">
I then have to add the exact information rigth underneath, but this time, the checkbox will be used to edit. So if checked, that line is edited. (I know you do not need a checkbox for this, but for consistency, they wanted one for edit to match the delete, since they are the same items). Here is the checkbox for edit <cfinput type="checkbox" name="edit/#urdn_number#/#urdn_line_item#" value="Yes">
Here is my question : If there are two line items (same) for the delete and edit, how do I check/compare so that if line item 1 is checked for delete and line item 1 is checked for edit, this is now allowed, since you cannot delete and edit the same line item.
I do not know how to validate this, so that is why I am posting.
My form displays mulitple line items and I add a checkbox next to each. If checked, that line is deleted. Here is my checkbox : <cfinput type="checkbox" name="del/#urdn_number#/#urdn_line_item#" value="Yes">
I then have to add the exact information rigth underneath, but this time, the checkbox will be used to edit. So if checked, that line is edited. (I know you do not need a checkbox for this, but for consistency, they wanted one for edit to match the delete, since they are the same items). Here is the checkbox for edit <cfinput type="checkbox" name="edit/#urdn_number#/#urdn_line_item#" value="Yes">
Here is my question : If there are two line items (same) for the delete and edit, how do I check/compare so that if line item 1 is checked for delete and line item 1 is checked for edit, this is now allowed, since you cannot delete and edit the same line item.
I do not know how to validate this, so that is why I am posting.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
/t5/coldfusion-discussions/checkbox-comparisons/m-p/197353#M17695
Jul 17, 2008
Jul 17, 2008
Copy link to clipboard
Copied
Use javascript to determine if both are checked, if they are,
then throw an alert and dont submit the form.
On the server side, check to see if both fields have been checked prior to running any actions.
And no, I wont write the code for you.
On the server side, check to see if both fields have been checked prior to running any actions.
And no, I wont write the code for you.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
trojnfn
AUTHOR
Participant
,
/t5/coldfusion-discussions/checkbox-comparisons/m-p/197354#M17696
Jul 20, 2008
Jul 20, 2008
Copy link to clipboard
Copied
The checkboxes are dynamically generated and there can be
multiple checkboxes for the edit and delete functions. The
checkboxes for the edit all have the same name, and they all have
the same name for the delete.
With javascript, how do I determine that delete 1 is checked and edit 1 is checked, etc. ?
If the checkboxes have different names, I can validate after submit by using cfif isDefined("delete_1")> and isDefined("edit_1")> to determine that both checkboxes for item 1 have been checked. But with the same name, I do not know how to determine which checkbox number was checked.
With javascript, how do I determine that delete 1 is checked and edit 1 is checked, etc. ?
If the checkboxes have different names, I can validate after submit by using cfif isDefined("delete_1")> and isDefined("edit_1")> to determine that both checkboxes for item 1 have been checked. But with the same name, I do not know how to determine which checkbox number was checked.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
LATEST
/t5/coldfusion-discussions/checkbox-comparisons/m-p/197355#M17697
Jul 25, 2008
Jul 25, 2008
Copy link to clipboard
Copied
quote:
The checkboxes for the edit all have the same name, and they all have the same name for the delete.
Do you mean that the edit and delete checkboxes share the same name?
For example:
edit: <cfinput type="checkbox" name="box_1" value="edit">
delete: <cfinput type="checkbox" name="box_1" value="delete">
If that is the case, you will have to validate against the value of box_1, not the name itself.. if the value is equal to "edit,delete" for box_1, then obviously both options have been selected. Checkboxes return their value as a list.
<cfif isDefined('form.box_1') AND form.box_1 EQ 'edit,delete'>
logic here.
</cfif>
Ideally, you should be using radio buttons in this situation since a user shouldn't be able to select both edit and delete to begin with.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

