Skip to Content Skip to Menu

Conditions plugin

  • smeallum
  • smeallum
  • OFFLINE
  • Posts: 26
  • Thanks: 0
  • Karma: 3
18 years 3 months ago #18013 by smeallum
Replied by smeallum on topic Re:Conditions plugin
Mikko: thanks much for taking a look

I changed all the occurrences in the cities of character ' to character ~ and still it loads all the cities from start instead of waiting for the countries selection to be made.

The javascript seems to keep on loading for ever, eventhough all the countries and cities have finished loading(it just takes a few secs for both dropdowns to load).

There must be something else that makes the script not finish.

Any idea?

Cheers,

Post edited by: smeallum, at: 2007/01/21 01:44

Please Log in or Create an account to join the conversation.

  • mikko
  • mikko
  • OFFLINE
  • Posts: 703
  • Thanks: 0
  • Karma: 115
18 years 3 months ago #18014 by mikko
Replied by mikko on topic Re:Conditions plugin
It works as designed, but it was not designed for this large amount of data. If you wait for the script to load and run, you will get the fields hidden. This will take a long time, though.

The plugin works in a way that it hides the fields and values after they have been loaded. If the amount of fileds is large, it just takes too long for the script to work.

A better alternative for you would be to load the fields on demand. Unfortunately there is no ready solution for this that I know of. It is possible to code as a plugin if you know ajax, though.

If you (or someone else) decides to code an alternative implementation using ajax, I can help woth that.

mikko

Post edited by: mikko, at: 2006/08/01 20:11

Please Log in or Create an account to join the conversation.

  • smeallum
  • smeallum
  • OFFLINE
  • Posts: 26
  • Thanks: 0
  • Karma: 3
18 years 3 months ago #18031 by smeallum
Replied by smeallum on topic Re:Conditions plugin
mmmm...this sounds contradictory with what i see, but i am limited in finding arguments to contradict you. You have developed this and you know how it works.

What i see is that the registration form shows up, and after about 4 seconds you can check the cities dropdown, and the more than 6000 cities are there in the cities dropdown, however the script seems to keep on executing, and seems to never end. Eventually you start getting messageboxes that say "The script is taking too long to execute....click to stop it or to continue..."

Are you saying that your script does actually fill all the options first and then goes through each of them and hides them or leaves them? Sounds strange to me.

Anyway, i have a tool called Web Developer Toolbar that i don't use much that has a tool called Javascript Console that shows the javascript errors of the form. The very last one and only that one of those errors relates to the conditions plugin.

I paste it here, maybe it gives you some extra input as to what the problem might be:

Error: [Exception... "'Permiso denegado para establecer la propiedad XULElement.selectedIndex' when calling method: [nsIAutoCompletePopup::selectedIndex]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: www.mysite.com/components/com_comprofiler/plugin/user/plug_conditions/funcs.js :: removeOption :: line 53" data: no]
Archivo de origen: www.mysite.com/components/com_comprofiler/plugin/user/plug_conditions/funcs.js
Línea: 53

FYI: TRANSLATION IN CASE NEEDED:
Permiso denegado para establecer la propiedad = Permission denied to set the property.

Archivo de origen = File that originated error

Hope there is a way out of this :(

Thanks

Post edited by: smeallum, at: 2006/08/28 07:16

Post edited by: smeallum, at: 2007/01/21 01:44

Please Log in or Create an account to join the conversation.

  • mikko
  • mikko
  • OFFLINE
  • Posts: 703
  • Thanks: 0
  • Karma: 115
18 years 3 months ago #18049 by mikko
Replied by mikko on topic Re:Conditions plugin
smeallum wrote:

Are you saying that your script does actually fill all the options first and then goes through each of them and hides them or leaves them? Sounds strange to me.


The script does not fill any options, it just uses DHMTL and hides things after browser has redered them.

Browser usually render the html document agressively, meaning that the rendering will start before the full ontent of the document has been received. Here the browser first receives the html of the tabs and starts to render them. Then it starts receiveing the script tag which contains the JS created by the plugin. After the whole script has been received, it will execute the script. In this case the script is approximately 3 megabytes of size, so in most cases there is a significant delay between the rendering of the tabs and the execution of the script. If you have sufficiently fast connection this is not a problem for you.

The second issue is that the JS in the script is not optimized for large amounts of data. Combined with the fact that JS is not known for high performance causees that gives you the error message of script executing too long. Javascript was never designed for scripts of this size.

Anyway, i have a tool called Web Developer Toolbar that i don't use much that has a tool called Javascript Console that shows the javascript errors of the form. The very last one and only that one of those errors relates to the conditions plugin.

I paste it here, maybe it gives you some extra input as to what the problem might be:

Error: [Exception... "'Permiso denegado para establecer la propiedad XULElement.selectedIndex' when calling method: [nsIAutoCompletePopup::selectedIndex]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: www.mysite.com/components/com_comprofiler/plugin/user/plug_conditions/funcs.js :: removeOption :: line 53" data: no]
Archivo de origen: www.mysite.com/components/com_comprofiler/plugin/user/plug_conditions/funcs.js
Línea: 53

FYI: TRANSLATION IN CASE NEEDED:
Permiso denegado para establecer la propiedad = Permission denied to set the property.

Archivo de origen = File that originated error

Which browser reports this? I am quite sure that this will not solve the problem, but it might be another one that is wirth fixing.

Hope there is a way out of this :(


If you take a look of any sites that have similar selects you will see that the city is loaded from the server after the country has been filled in. This is because it is a much better solution if the amount of entries is large.

However, it might be possible to achieve a working solution with client side scripting only, but this would require refactoring of the plugin. This would involve the following steps:
-separate the connditions data and the scipts
-load conditions data and the scripts before tabs
-fire the script after tabs

I can help ypu with this, but currently it is not possible for me to take aside the time needed to code it myself.

mikko

Post edited by: mikko, at: 2006/12/22 07:27

Please Log in or Create an account to join the conversation.

  • ralex
  • ralex
  • OFFLINE
  • Posts: 20
  • Thanks: 0
  • Karma: 0
18 years 3 months ago #18055 by ralex
Replied by ralex on topic Re:Conditions plugin
ralex wrote:

thanks man... i'll try ur suggestion...:)

tried the plugin but no luck ...
i'm stuck ...

- install and published the plugin

- plugin id = 100
- tabs: 1. group1, 2. group2, 3. group3
- i created new field (DropDown -single select, tab: group3, name: cb_privacypolicy, title: option, value: A, B)
* group1 belongs to A, group2 - B and group3 belongs to everybody)

can u help me to go from here...

Post edited by: ralex, at: 2006/08/01 19:32


mikko...
i need ur help ...:(

Please Log in or Create an account to join the conversation.

  • mikko
  • mikko
  • OFFLINE
  • Posts: 703
  • Thanks: 0
  • Karma: 115
18 years 3 months ago #18056 by mikko
Replied by mikko on topic Re:Conditions plugin
You need to do two things
1) Understand how the code works. You can read the source and for example these threads:

www.joomlapolis.com/component/option,com_joomlaboard/Itemid,38/func,view/id,15289/catid,23/limit,6/limitstart,0/
www.joomlapolis.com/component/option,com_joomlaboard/Itemid,/func,view/catid,13/id,14367/

2) Code the checks that need to be done for your site to the source code

3) Please share the result here

Unfortunately I have not had time to finalize this. It currently does most of the things that I need, but for your case you need to extend it.

If you know php and basics of the techncal side of CB it should not be too hard. If not, then the alternatives are to learn or hire someone to code it for you.

mikko

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum