itec
Posts: 130
|
| Posted: 03/19/2005, 10:22 PM |
|
Hello,
What i am trying to do is I have categories in a list box and what i am trying to do is delete from list box
example:
I have a a text box where i can add ( demo )
and at the bottom in different record I have a list box
When i add demo in text box it shows in the listbox at the bottom
I want to be able to select demo from the list box then click delete but when i preview the delete button dissappers
any reason why and how i can accomplish this.
Thanks
|
 |
 |
peterr
Posts: 5971
|
| Posted: 03/19/2005, 11:17 PM |
|
Soryr, I didn't understand what you mean by "preview". Could you explain what and how are you previewing?
I also didn't understand when the delete button appears (vs. disappears), what form types do you use, and which form you'd like to use for deleting a record.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
itec
Posts: 130
|
| Posted: 03/19/2005, 11:19 PM |
|
Yes when i select live preview the delete button dosent show
|
 |
 |
peterr
Posts: 5971
|
| Posted: 03/19/2005, 11:23 PM |
|
Do you mean when you view the Live Page?
If "Delete" button doesn't show then it means that everyhing is OK 
The Delete button should never show until there is a specific record to be deleted. Thus when for example the URL points to some specific record (like user_id=1) and such record is found, only then the Delete button will be shown. Otherwise there is nothing to delete.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
itec
Posts: 130
|
| Posted: 03/19/2005, 11:25 PM |
|
ok look at this http://sundragons.com/basic.jpg see how remove category is there?
ok thats what i am trying to accomplish but it dosent have a button for me to delete it so if i cant see it how do i delete it
|
 |
 |
peterr
Posts: 5971
|
| Posted: 03/19/2005, 11:46 PM |
|
The issue is that a listbox there is just a field inside a record form. Thus the record can be deleted but not the field/listbox value . To understand this you can create any record form with a text field. You will then see that pressing "Delete" cannot delete a value from the textbox field (that would be scary!) but the current record that you are displaying. Then you can change the textbox field to listbox field and the same will be true: you can delete only the record, not some value of a field inside the record.
More importantly, imagine what would happen if you had a form like this: http://examples.codecharge.com/TaskManager/TaskRecord.php?task_id=5 (login as admin/admin), and you selected the listbox values there, then pressed "Delete", and instead of deleting the record we would delete all your listbox values in several other tables... 
As for the solution to your issue, I'm not sure right now what you can do but you may have to find different approach, maybe using some event. Possibly someone else will help.
I will also try to think about this and may get back to you.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
peterr
Posts: 5971
|
| Posted: 03/20/2005, 12:03 AM |
|
OK, I quickly went through our code examples in the docs and I think that you could try this:
1. Clear the "DataSource" property value for your form that contains the listbox, so that the form will become a search form, instead of inserting/updating/deleting something.
2. Change your "Remove category" button's "Operation" property to "Search".
3. In one of the events (see below) use the code from: http://docs.codecharge.com/studio/html/ProgrammingTechn...eCustomSQL.html
But modify that code so that instead of inserting, it deletes a record from your table based on the listbox value.
Now the only question is which event to use to read your listbox value and delete corresponding record. I'm thinking that maybe On Validate event would work for this, but I'm not sure. You could also try On Click.
I'm also not sure if this is the best approach and I haven't tested it, but I would probably try this first.
Maybe someone else would have other suggestions.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
itec
Posts: 130
|
| Posted: 03/22/2005, 12:38 AM |
|
Well I hope someone out there can help with this problem I submitted a support ticket and was told told that they already answered this question with the above answer unfortunatly it does not work
|
 |
 |
peterr
Posts: 5971
|
| Posted: 03/22/2005, 12:50 AM |
|
Sorry, I didn't know that it doesn't work for you. Could you please explain what means "does not work"? Which part of the above solution doesn't work for you and what errors do you see?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
itec
Posts: 130
|
| Posted: 03/22/2005, 1:04 AM |
|
when I use the above solution it doesnt delete anything
|
 |
 |
itec
Posts: 130
|
| Posted: 03/22/2005, 1:06 AM |
|
although i have accomplushed this in hand code but then my hand code will not work in ccs I think this is the longest i have ever spent on a function Im shooting for almost 5 days lol hand coding is great and wrks perfectly just cannot get the function to work in ccs
|
 |
 |
peterr
Posts: 5971
|
| Posted: 03/22/2005, 1:12 AM |
|
In such case what was your final SQL statement? And did you check if it works with your database, outside of CCS? You may also need to do little debugging and print the SQL statement, print the values and make sure that they are not blank, try your SQL against the database, etc.
I also checked our support system and I see that Helen there offered a different solution, but we also don't have any details on what didn't work for you and what were your debug results.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
itec
Posts: 130
|
| Posted: 03/22/2005, 1:19 AM |
|
oh so i am guessing since this isnt possible in ccs the only way to have a category is if you have a page dedicated to a grid
|
 |
 |
peterr
Posts: 5971
|
| Posted: 03/22/2005, 1:21 AM |
|
Just saw your post about hand coding and I can only recommend that you do not keep all those things secret! 
When you applied my proposed solution I don't know what code you used, what SQL you used, what were your variable values, which event you used, or what was the hand coded function that you tried, etc. In fact, I know so little that I just don't know how to help you. All I know is "it doesn't work". This could possibly be 1-minute fix if we only knew anything about what you did... 
Please, please, please let help us help you
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
peterr
Posts: 5971
|
| Posted: 03/22/2005, 1:25 AM |
|
The solution I offered was for CCS, although indeed it required using custom code in an event.
Though I didn't understand what you mean by "the only way to have a category is if you have a page dedicated to a grid". A category is just a piece of data that can be present on any type of page or form, I think.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
itec
Posts: 130
|
| Posted: 03/22/2005, 2:03 AM |
|
What i meant by grid is I would have to have a grid of categorys a whold page for just categorys that way they can be deleted, also when i restrict a page all i get is this
Fatal error: Cannot redeclare cccheckvalue() (previously declared in c:\apache\htdocs\cms\Classes.php:72) in c:\apache\htdocs\cms\Classes.php on line 72
everything works if its not restricted
|
 |
 |
peterr
Posts: 5971
|
| Posted: 03/22/2005, 11:27 AM |
|
This error usually means that a file was included twice (probably Classes.php).
I'm not sure how this could happen, but possibly you modified some code and added "Classes.php" 2nd time?
Or maybe you are using an Includable page that later was changed to non-Includable?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |