Forum OpenACS Development: Error ajaxhelper - Invalid switch: "-default"

Hi,
I am totally excited about the new ajax possibilities this package is providing. I am getting this error when following
http://www.solutiongrove.com/blogger/one-entry?entry%5fid=266153
using ajaxhelper version 0.82d:

Invalid switch: "-default"
while executing
"ah::js_sources__arg_parser"
(procedure "ah::js_sources" line 1)
invoked from within
"ah::js_sources -default"
invoked from within
"set sources [ah::js_sources -default]"
("uplevel" body line 101)
...

Any hints are greatly appreciated!

Best regards
Klaus

Collapse
Posted by Klaus Hofeditz on
Changing

set sources [ah::js_sources -default]
to
set sources [ah::js_sources -source default]

does not break the script anymore.

When including now:

set fadescript [ah::effects -element "test" -effect "Fade" -options "duration:2.0,afterFinish:function() { alert('element is gone'); }" ]

"ah::is_valid_source" throws:

invalid command name "scriptaculous"
while executing
""scriptaculous" \
"
(procedure "ah::is_valid_source" line 5)
invoked from within
"ah::is_valid_source -js_source $source"
(procedure "ah::requires" line 12)
invoked from within
"ah::requires -sources "prototype,scriptaculous-effects"
"
(procedure "ah::effects" line 3)
invoked from within
"ah::effects -element "test" -effect "Fade" -options "duration:2.0,afterFinish:function() { alert('element is gone'); }" "
invoked from within
"set fadescript [ah::effects -element "test" -effect "Fade" -options "duration:2.0,afterFinish:function() { alert('element is gone'); }" ]"
("uplevel" body line 101)
invoked from within
...

Collapse
Posted by Hamilton Chua on
Hello Klaus,

Sorry for the late reply.
In the latest update to ajaxhelper (which was about 6 months ago ) ah:::js_sources now accepts a comma separated list of javascript sources. So you can do for example

[ah::js_sources -sources "prototype,scriptaculous"]

Regarding your latest error message. Can you check the proc in ajax-procs.tcl in your ajaxhelper folder.

It should look like this ...

****************************
ad_proc -private ah::is_valid_source {
-js_source
} {
This proc will determine if the js_source file is the name is a valid name associated to
a javascript source. This proc contains hard coded list of javascript sources that
ajaxhelper supports.

@author Hamilton Chua (mailto:ham@solutiongrove.com)
@creation-date 2006-12-19
@param js_source The name of the javascript source to check
} {

set valid_sources [list "prototype" \
"scriptaculous" \
"scriptaculous-effects" \
"scriptaculous-dragdrop" \
"autosuggest" \
"rounder" \
"overlibmws" \
"overlibmws_bubble" \
"overlibmws_scroll" \
"overlibmws_drag" ]
set found [lsearch -exact $valid_sources $js_source]
if { $found == -1 } {
return 0
} else {
return 1
}
}

******************

Please let me know if it is the same. I haven't been able to replicate your error message in my install with ajaxhelper from head so my current conclusion is that the code may be different or changed on your instance.

Thanks for trying out Ajaxhelper.

Hamilton

Collapse
Posted by Klaus Hofeditz on
Hi Hamilton,
thanks so much for your _quick_ answer. I compared the code and everything looks fine.
Forgoing backslashes/LFs in the list made the function work.

Thanks again for your support and for providing this package.

Best regards
Klaus