CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Remove items from a listbox (Resolved)

Print topic Send  topic

Author Message
saseow

Posts: 744
Posted: 04/30/2014, 5:02 PM

I have a listbox which retrieves data from a table.
Depending on the value of another listbox, I want to dynamically remove some items from the listbox using either javascript or AJAX.
Is this possible and if so, has anyone got any code examples?
Thanks!
View profile  Send private message
DataDoIT
Posted: 04/30/2014, 8:00 PM

You just described the Dependent Listboxes feature. Look at the builder
and see if you can make it fit your need.
MichaelMcDonald

Posts: 640
Posted: 04/30/2014, 8:48 PM

Can I see a different application to standard DLB here being inferred here.

Not quite sure what T means but curious to know what the application of such a feature might provide


I'm guessing the relationship between the listboxes might not always be static, and in fact
selecting from the first LB could perform a function, perhaps an mathematical operand that could determine the values available of the second list box that only java could do...


_________________
Central Coast, NSW, Australia.

View profile  Send private message
saseow

Posts: 744
Posted: 04/30/2014, 9:42 PM

Thanks for the replies!
Dependant listboxes will not work because the KeyWord (i.e. link between the listboxes) is not useable as Michael says. e.g. Master list box contains 5 items and slave contains 7. Only when a particular single item is selected in the Master, the slave should display only 4 of the seven items. The link between the two in a dependant listbox situation cannot accomodate this scenario.
View profile  Send private message
saseow

Posts: 744
Posted: 05/01/2014, 1:28 AM

Finally resorted to JS using without the logic:

var status = document.getElementById("Contentslas_ticketsstatus_id");

status.remove(6);
status.remove(5);
status.remove(4);
View profile  Send private message
DataDoIT
Posted: 05/04/2014, 6:41 PM

Ah. That's what we affectionately refer to as a hack.

Get your DB structure formatted in such a way so as to not have to rely
upon front-end workarounds to present queried data.
saseow

Posts: 744
Posted: 05/04/2014, 11:39 PM

Far easier said than done in this case. The system has been live for a long time so IDs are in countless records. No way to change them all by sql easily if the structure changes.
A hack is a hack but it does work! :)
View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 05/05/2014, 9:42 PM

Have you commenced development on something which could function as a substitute for DLB's?
_________________
Central Coast, NSW, Australia.

View profile  Send private message
saseow

Posts: 744
Posted: 05/05/2014, 10:05 PM

Unfortunately not Michael.
This is a live project and, as I mentioned, it is just not possible to use DLBs as they are now. As DDI said, this really is a hack.
As a long shot, you would not know about the problem where ccForm is added to the end of the URL would you?
http://forums.yessoftware.com/posts.php?post_id=120461

I am having this hassle on the live server but not on my local machine.
View profile  Send private message
eratech


Posts: 513
Posted: 05/05/2014, 10:42 PM

saseow,

So the dependant listbox scenario would work, but not in this application because of how it's set up.

You could also filter the slave_LB options using jquery - similar to your status.remove() but better targeted instead of specific items by ID. Still dependant LB but on the client only.

Let me know how you go

Eric

_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
View profile  Send private message
saseow

Posts: 744
Posted: 05/05/2014, 10:51 PM

Thank you for this Eric. I have thought oif this but because of time restraints I have not got around to it.
When I do, I will post the results here using modified DLB query.
Trevor
View profile  Send private message
saseow

Posts: 744
Posted: 05/06/2014, 1:42 AM

Well, the client had a change of heart and wanted to split the master listbox into two.
Got rid of all the hacks and DLB is now feasable and in operation.
View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 05/06/2014, 3:11 AM

ccsForm only thing I can say I have observed which might be of interest is that it looks like it appends to the form during an on validate event possibly as some kind of caching mechanism for the items that have passed validation.
_________________
Central Coast, NSW, Australia.

View profile  Send private message
saseow

Posts: 744
Posted: 05/06/2014, 3:52 AM

Thanks Michael, I noticed that too.
I managed to get rid of it by removing ccsForm from all the parameters and then added this to the validate event:

global $FileName;
$QueryString = CCGetQueryString("QueryString", "");
$QueryString = CCRemoveParam($QueryString, "ccsForm");
header("Location: " . $FileName."?". $QueryString);

A shlep but at least it works.
View profile  Send private message
eratech


Posts: 513
Posted: 05/06/2014, 5:47 PM

Michael - you are right about the caching. I knew it was used on form submit but thought it was a 'which form submitted' indicator.

Per the online help topic "Page and Component Caching" it is (combining 2 descriptions):

Quote :
Name: ccsForm
Source: URL
Target: Nonempty value bypasses the cache Disables cache when a form is submitted, as submitted forms add "cssForm" parameter to the URL.
Do not cache the page during the processing of the submitted search form. "ccsForm" is a temporary URL parameter used by Web applications to determine if a form was submitted and needs to be validated and processed.

Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
View profile  Send private message
saseow

Posts: 744
Posted: 05/08/2014, 2:26 AM

Removing the ccsForm parameter from the URL nullified all validation on the form. This is obviously not the solution.
It is strange that the ccForm parameter causes a hassle on the production machine but not on my local machine running xampp.
Back to the drawing board but hope someone has an answer to this.
View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 05/08/2014, 2:03 PM

Might just be a stab in the dark but another thing I have noticed is the difference between how local windows dev environments v production servers handle session variable paths.

I used WAMP and in php.ini it would not matter what the session save variable path was, did not care, session variables always worked.

On as server it always had to be the hosting account username for example /home/username/
_________________
Central Coast, NSW, Australia.

View profile  Send private message
eratech


Posts: 513
Posted: 05/08/2014, 8:00 PM

I'm suspecting the hosting settings as well, or something in the server. I've used CCS on a bunch of servers (LAMP VM's, Local dev on MAMP and WAMP, and IIS 6) and haven't see problems with validation/blank pages like you describe.

Could you set up an alternative server (eg: VMPlayer and turnkeylinux LAMP appliance) and test it there? Bit of work I know, but I like testing outside my Dev box to catch these sort of things.

Cheers

Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
View profile  Send private message
saseow

Posts: 744
Posted: 05/08/2014, 9:46 PM

Well gents, I am extremely embarrased about this. A case of could not see the trees for the wood.
When I saw 'Invalid Address' my immediate thought was memory or Db pointers etc. etc. Ran test upon test on three different servers, Windows and Linux, all to no avail.
Now the bulb goes on at 4am this morning:
After inserting the record emails were being sent out to various interested parties. For this particular project there were no interested parties entered into the DB hence the error which means exactly that in PHPMailer....'Invalid Address:".
Oh dear....what a cockup!
Checks now all coded, published to Live and everything is as it should be with validation working correctly!
I am sorry but thank you all for your input.
With kindest regards from a very 'red in the face' Trevor.
View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 05/09/2014, 4:17 AM

4 am - no matter where you live in the world - i.t. geeks need a staple of coke and pizza.
Gotta have that caffeine, cannot leave this damn computer until i get this working!


I've been this way for 20 years. can't be helped...
_________________
Central Coast, NSW, Australia.

View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 05/09/2014, 5:07 AM

BTW .. are any of you in Sydney or Brisbane Australia?


_________________
Central Coast, NSW, Australia.

View profile  Send private message
saseow

Posts: 744
Posted: 05/09/2014, 5:14 AM

Nope, far better!
Cape Town.
View profile  Send private message
eratech


Posts: 513
Posted: 05/10/2014, 11:05 PM

Melbourne

Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 05/11/2014, 5:35 AM

Melbourne's good.


_________________
Central Coast, NSW, Australia.

View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.