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

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