Provide demonstration module

robertDouglass - April 9, 2006 - 13:19
Project:Active Select
Version:HEAD
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:needs review
Description

I extracted and modified the code from API.txt a bit to make a demonstration module. It still needs a hook_help, and ideally it would show a couple use cases, but it is much easier to comprehend the API when seeing it in action, and it also provides a good test bed for people to experiment.

AttachmentSize
activeselect_test.zip951 bytes

#1

drupal777 - June 6, 2006 - 14:19

I have put the module into the /modules folder and enabled it through administer->modules.

Pardon my ignorance, but what else must be done to see the demonstration?

#2

geodaniel - February 2, 2007 - 14:28
Status:active» needs review

#3

jonathan_hunt - February 6, 2007 - 08:51

I tried this on 5.1 with the following changes:
a. module_exist() is now module_exists()
b. function activeselect_test_form_page() should return drupal_get_form('activeselect_test_form_page', $form); instead of drupal_get_form('foo_form_page', $form);
c. An activeselect_test.info file like

; $Id$
name = activeselect_test
description = "Example of activeselect."

But I get an error browsing to /activeselect_test:

Fatal error: Maximum function nesting level of '64' reached, aborting! in /home/www/web46/web/drupal-5.1/includes/module.inc

#4

liquidcms - February 19, 2007 - 03:36

I am just trying to learn activeselect since i need an AJAX based category/container selection app in my project (and thought it might help). But checking out your demo; either i don't get AS.. or perhaps this isn't it?

What i get from the demo can be seen in attached pic. What i see when i load page for first time is multiple options in each box which are then "hidden" until selecting option in top box.

But isn't activeselect supposed to be AJAX? This isn't AJAX. The values are all loaded with the initial page fetch and the demo simply uses JS to manipulate DOM to display correct options. Perhaps AS is able to do both; but it can do AJAX as well can't it? - hopefully because my app does require AJAX.

I guess i will start going through the API to see if i can use AS to hack in what i need the category module to do... and hopefully won't take too long to figure out if it is AJAX happy.

Peter Lindstrom
LiquidCMS - Content Management Solution Experts

AttachmentSize
as_test.jpg 14.74 KB

#5

geodaniel - February 19, 2007 - 09:41

The way I understand it is that Drupal's form API requires that all select boxes must be filled with all possible values when the page is generated, to ensure that it passes the validation. This is why Active Select does that. If it's not in the form when it's generated, it won't get through validation.

Perhaps that is validation that could be overridden in the forms API?

#6

liquidcms - February 20, 2007 - 05:34

hmmm.. yea.. don't think so.

validation is checking what was entered in the fields (including select boxes) when the form is submitted.. nothing to do with when the page (you mean form, right??) is generated. And it certainly doesn't need to validate all the values ahead of time. Although, i guess if you had a select list that had entries that would not pass validation (when form submitted) it would seem a little silly.. so maybe drupal is trying to do something smart ahead of time...

BUT.. this would then destroy the entire point of AJAX.. AJAX is intended to reduce data being sent back to browser so pages can refresh faster.. and then as you need more info (if you need it later) AJAX gets it for you.. for instance.. take the common example of countries, states, cities

the list of countries is pretty small (200-300) the list of ALL the citieis in the world is huge.. likely 10,000's

AJAX is perfect fit here.. we only send countries on initial page fetch - and states and cities are blank.. until we pick a county then we fetch the few states we need.. then we pick state and fetch the few cities we need...

pretty sure drupal wouldnt intentionally break this concept.

#7

newdru - February 26, 2007 - 23:15

Anybody making headway with this. I'd like to see a country, region, city active select that uses AJAX myself?

#8

liquidcms - February 26, 2007 - 23:56

now that i am working with activeselect a lot more... i can see that geodaniel is correct in that all values for all the lists are sent the first time around...

I am not sure this is to pass validation - i think it is for the case where JS is not enabled on the browser.

BUT... JS is enabled 99% of the time.. and if it isn't just put a note and tell them they need it.. or to piss off

i think to make AS select usable for a real situation such as the country/state/city example - it needs to at least have a setting that bypasses the "send all" feature Or it is not usable.

this really needs to be raised as a separate issue as i am sure Jeremy will never see it buried here.

#9

revival - April 17, 2007 - 18:56

Agree with ptalindstrom that not all values should be passed all the time..

 
 

Drupal is a registered trademark of Dries Buytaert.