Bug in Spry.utils
I created a
test
case where you can see that Spry doesn't work properly with
dash separated class names. The problem is in RegExp: basically
/\bword\b/ matches not only word in "first word", but also in
"first word-based". To avoid it change your RegExp to something
like: /(^|\s)word(\s|$)/
Hi,
Indeed this is a Spry1.4 bug, but it is fixed for the Spry
1.5 release that will come soon this week.
Thank you for reporting this issue.
Diana
Similar Messages
-
Bug in Spry.Utils.setOptions?
v1.4 Spry.Utils.setOptions, in the snippet below,
shouldn't it be
... && obj[optionName] == undefined
instead?
fyi.
============
for (var optionName in optionsObj)
if (ignoreUndefinedProps && optionsObj[optionName]
== undefined)
continue;
obj[optionName] = optionsObj[optionName];Hello,
Actually the current implementation is how the function was
intended to work. There are places into Spry where the options
object gets passed around. We needed a way of saying don’t
copy this value if the key exists and its value is undefined
otherwise valid values already there would be destroyed.
In your case you want only a predefined list of entries from
the target array to be checked and overwritten by the entries
existing in the source array. The rest of the source keys should be
ignored. In this situation you should make sure however that all
the entries that you need are already defined otherwise problems
will appear.
You may create your own static function
Spry.Utils.setOnlyExistingOptions that should achieve your goal.
Regards,
Cristian MARIN -
Spry.Utils.updateContent & IE caching pls help
Hi -
so ive read quite a few posts about this problem but no
single - comprehensive solution. Basically im using updateContent
to show and refresh a mini basket display on my ecom site. works
great in firefox but in IE7 the shopping basket apparently gets
cached the first time it gets updated and and then only updates the
cached version thus making it appear as if you havent actually
added anything to your cart. I know it's a cache issue cause I
clear the cache, re-updateContent, and the most current basket
state renders.
It seems like this should be documented somewhere - hopefully
someone can offer up a straightforward solution.
Cheers
AndyHi Andy,
By default Spry.Utils.updateContent() uses the "GET" method
for requesting a fragment from the server. What this means is that
you are at the mercy of the Browser's caching system and the
caching rules specified for that fragment by the Web Server. IE6,
not sure about IE7, also had a bug where even though the server
says don't cache my page, IE still insists on caching the page ...
a workaround was to append a query param to your URL that made the
URL unique, for example the local time:
Spry.Utils.updateContent(ele, "myfoo.php?id=12&curTime="
+ Date.now(), myCallback);
The other workaround is to use the "POST" method. Most
browsers don't cache results from a "POST" because that is what
most web applications use to fetch data that changes.
Spry.Utils.updateContent(ele, "myfoo.php?id=12", myCallback,
{ method: "POST" });
--== Kin ==-- -
Spry.Utils.loadURL headers problem
I am posting a request with the loadURL function.
I am getting two values from a form :
- a WYSIWYG texarea editor which id is 'elm1'
- an input text field 'contentfilename'
In my textarea, I wrote a phone number that have the
following cars : +33
My PHP script that receive the posted data ($_POST variables)
don't receive the '+' cars.
Why is that ??
Here is my save function :
function saveEditorContent() {
var dataString = "elm1="+
tinyMCE.getInstanceById('elm1').getHTML()
+ "&contentfilename=" +
document.getElementById('contentfilename').value
var options = {
postData: dataString,
headers: {"Content-Type":
"application/x-www-form-urlencoded; charset=ISO-8859-1" },
errorCallback: saveEditorError
var url = "editorAction.php?action=savecontenteditor";
var req = Spry.Utils.loadURL( "POST", url, true,
saveEditorSucess,options );
removeMCE('elm1');
spEditor.showPanel( 2 ) ;
function saveEditorSucess(req) {
Spry.Utils.setInnerHTML('statusMessageBox',
'SUCCESS<br/>'+req.xhRequest.responseText );
Thank you
CorentinHello,
You miss a step in this code. You'll have to URI encode every
value you will send to the browser. In your situation the + in the
phone has a special meaning in the URI encoding and will be treated
as a blank space.
Please modify the following line:
var dataString = "elm1="+
tinyMCE.getInstanceById('elm1').getHTML()
+ "&contentfilename=" +
document.getElementById('contentfilename').value
with this one:
var dataString = "elm1="+
encodeURIComponent(tinyMCE.getInstanceById('elm1').getHTML())
+ "&contentfilename=" +
encodeURIComponent(document.getElementById('contentfilename').value);
Regards,
Cristian -
Spry.Utils.loadURL problem with IE7
Hello there. First of all sorry for my english.
I have a problem with Spry.Utils.loadURL function in Internet
Explorer 7 only. In firefox works fine.
So i have an asp file that returns a string with some stuff.
I load this asp file with Spry.Utils.loadURL like this.
function ReLoadExtras() {
var req = Spry.Utils.loadURL("GET",
"ControlExtras.asp?type=get&id=50", true, MySuccessCallback);
function MySuccessCallback(req) {
Spry.Utils.setInnerHTML('Extralist',
req.xhRequest.responseText);
In interner explorer works fine only at the first page load.
I have a button that fires the ReLoadExtras() function. But if i
hit it again to reload the div's content return nothing or returns
the same string. The string that ASP file returns is a value from
database but if i change this value on the database and hit the
button again i get the previus value. I think that something is
going wrong with the internet explorer's cache. I'm going crazy
because in firefox works without any problem.
Anynone who can help :-)Finally i fixed this problem. The problem was Internet
Explorer's cache. Every time that i call the asp file i have to
make the url unique. So i create a function that creates a unique
url.
function ReLoadExtras() {
var url =
"ControlExtras.asp?ControlExtras.asp?type=get&id=50";
var req = Spry.Utils.loadURL("GET", MakeUniqueQuery(url),
true, MySuccessCallback);
function MySuccessCallback(req) {
Spry.Utils.setInnerHTML('Extralist',
req.xhRequest.responseText);
function MakeUniqueQuery(x) {
var temp = Math.random() * 3;
var tempurl = x + "&sid=" + temp;
return tempurl;
} -
Spry.Utils.loadURL problem
I'm having trouble with the last parameter of
Spry.Utils.loadURL.
I know I need more info in the last argument but I cannot
find good documentation on this. I can work out how to do it with
form data, but not with data passed as a simple variable parameter.
ANY help appreciated!
In the code snippet below I am trying to pass a value to
Spry.Utils.loadURL that will them be passed to resfunc as request.
But I cannot work out how to do this.
The function that calls Spry.Utils.loadURL works ok., I test
that it is receiving the correct value by using alert(value). But
how do I get this value into the argument list of
Spry.Utils.loadURL so I can display it?
function doFormPost(url,photoId,resfunc) {
formData = encodeURI(photoId);
Spry.Utils.loadURL('POST', url, true, resfunc,
{"Content-Type": "application/x-www-form-urlencoded;
charset=UTF-8"});
function resFunc(request) {
var mydiv = document.getElementById("foo");
var result = request.xhRequest.responseText;
$("result").innerHTML = "Result was: " + result ;
mydiv.innerHTML = result;
function HandleThumbnailClick(id, photoId)
StopSlideShow();
doFormPost('moon.cfm', photoId,resFunc);
dsPhotos.setCurrentRow(id);
ShowCurrentImage();Hi Kate,
I think what you are trying to do is this:
function doFormPost(url,photoId,resfunc) {
// URL encode the photoId value.
formData = encodeURI(photoId);
// Build the headers object *outside* of the loadURL call to
reduce *visual* confusion.
// All we want to do here is to make sure that when we make
the request, that the browser also
// tell the server that the data we are sending in postData
is url encoded.
headers = {};
headers['Content-Type'] = "application/x-www-form-urlencoded;
charset=UTF-8";
// Send the post request, making sure to pass the content
type header and formData in the options object.
Spry.Utils.loadURL('POST', url, true, resfunc, { headers :
headers, postData: formData });
The 5th argument loadURL is an options object. You can
specify the named properties on this object that you want, for
example "headers" and "postData". The names of the option
properties you can specify are:
username - String that specifies the username on the server
to use when making the request.
password - String that specifies the password to use when
making the request.
postData - URL encoded string of name value pairs. Used when
the request is made with "POST".
errorCallback - Function to call if an error comes back from
the server after the request is made.
headers - Object that allows the caller to send additional
HTTP headers with the request. The properties on this object are
the named after the HTTP property. The value for the property is
the value to send. For example if you wanted to send this HTTP
property as part of the request header:
Content-Type: application/x-www-form-urlencoded;
charset=UTF-8
You would add this to your options object:
headers: { "Content-Type":
"application/x-www-form-urlencoded; charset=UTF-8 }
userData - This is anything you want to pass into loadURL. It
will be stored on the request object so that when your
successCallback/errorCallback is triggered, you can access it. For
example:
var myString = "This is a test!";
function myCallback(request)
alert(request.userData); // Alerts with the string "This is
a test!"
Spry.Utils.loadURL("POST", url, true, myCallback, { headers:
headers, postData: formData, userData: myString });
I realize this is annoying that it isn't documented
extensively. We are working on it.
--== Kin ==-- -
Spry.Utils.stringToXMLDoc or a Substitute
I am looking for a detailed guide for using the
Spry.Utils.stringToXMLDoc function. I am not having the best of
luck on finding detailed information on the function and would like
to learn more about. I would appreciate it if you could please post
some resources on this function or if there are other ways to get a
xml string into a XMLDataSet.
CheersWe only have this:
http://labs.adobe.com/technologies/spry/articles/data_api/apis/utils.html#stringtoxmldoc
and this:
http://labs.adobe.com/technologies/spry/samples/data_region/XMLStringSample.html
--== Kin ==-- -
Spry.Utils.loadURL userData
is it possible (and how) to get the userData property back to
my success-script?
Spry.Utils.loadURL("GET",
"/updater.cfm?"+formfield+"="+encodeURIComponent(fieldcontent),
false, checkstatus, {userData: "4711"});
function checkstatus(request) {
var fieldcontent = request.xhRequest.responseText;
var userdata = ?????
herbertHi Kate,
I'm guessing this is related to your validation function
post, so I'm going to give an example with that assumption:
function MyValidationFunction(value, options)
// Call loadURL() to validate the username synchronously.
Notice
// that I passed a false for the 3rd arg to force the
request to be
// processed synchronously.
var request = Spry.Utils.loadURL("POST",
"userExists.cfm?name=" + encodeURIComponent(value), false);
// The assumption here is that the server is going to reply
// with the word "true" (Content-Type: text/plain) if the
name
// already exists, or "false" if it doesn't already exist.
If
// you want to get fancy and return a response wrapped in
XML,
// or some other format, you'll have to parse it out
yourself.
// Since this validation function needs to return "true" if
the
// name doesn't exist, we need to make sure we don't get a
"true" value back!
return request.xhRequest.responseText != "true";
--== Kin ==-- -
Spry.Utils.LoadURL Help
I've set up a form:
<form>
<input id="question" type="hidden">
<input id="answer" type="text" onblur="checkAnswer();">
<span id="response"></span>
<input id="submit" type="button" value="submit">
</form>
using spry.utils.loadurl successfully pass the question and
answer to a php page that verifies that the question and the answer
are found in the database... it then returns a "Valid answer" or
"invalid answer" to the span below the form.
it is successfully returning the correct response...but it
doesn't prevent the user from submitting the form...any
ideas?I've set up a form:
<form>
<input id="question" type="hidden">
<input id="answer" type="text" onblur="checkAnswer();">
<span id="response"></span>
<input id="submit" type="button" value="submit">
</form>
using spry.utils.loadurl successfully pass the question and
answer to a php page that verifies that the question and the answer
are found in the database... it then returns a "Valid answer" or
"invalid answer" to the span below the form.
it is successfully returning the correct response...but it
doesn't prevent the user from submitting the form...any
ideas? -
Spry.Utils.getNodeText
Hi all,
I am having trouble figuring out why Spry.Utils.getNodeText
doesn't work. It should be pretty simple from the example. When I
do something simple as the following though, I get errors:
var one = Spry.Utils.getNodeText("toggleFakeTrigger");
toggleFakeTrigger is the id of a row such as:
<tr id="fakeRow" class="subTableHeader">
<td id="toggleFakeTrigger" class="rowHeader
expandButton">Fake</td>
<td><span
class="bold">$1,329.14</span></td>
<td><span
class="bold">$3,289.81</span></td>
</tr>
I am using Firebug and the message it gives me is:
Spry.Utils.getNodeText is not a function. I am referencing both
SpryData.js and SpryDOMUtils.js. It should be cut and dry. Why
isn't this working? WHy isn't it returning the text? It doesn't pop
up the alert, by the way. Thanks!I shouldn't have been so hasty with my previous answer. I
just remembered that innerText is IE only. You'll want to do
something like this:
function getTextContent(ele)
ele = Spry.$(ele);
return ele.textContent ? ele.textContent : (ele.innerText ?
ele.innerText : "");
var one = getTextContent("toggleFakeTrigger");
--== Kin ==-- -
Spry.Utils.setOptions
I'm creating an object with spry as a property...i want to
trigger the loading of the spry myself so i rely on setting up the
spry data set manually and triggering the loadData
can you use setOptions to
quote:
Spry.Utils.setOptions({subPaths: 'parm/value'})
and other variables as necessary?Spry.Utils.setOptions() is defined in SpryData.js ...
including that file should get rid of the error.
--== Kin ==-- -
Append swf file - Spry.Utils.updateContent - not work
I don't understand this
When I try to add swf file to Spry Tabbed Panels content -
everything is OK. Now - in tabbed panels content I want to insert
data from external html files. In this external file I have swf
file and text, and images. When I preview this html external file
in browser - all data are displayed correctly. When I try append
this file into tabbed panels content :
<a href="#" onclick="Spry.Utils.updateContent('apDiv1',
'products/products1.htm'); return false;">Append file</a>
only swf file in a new window are display.
If I delete swf content from external html file - everything
is ok. But if in external append file is a swf content - IE display
only swf file.
Is there posible to append html file with swf file in this
method in any way?Hi Elaine,
The implementation of AC_FL_RunContent() suggests that it was
only meant to be run *BEFORE* the page finishes loading. Because
Spry data sets and regions load and redraw asynchronously, usually
*after* the page finishes loading, they are not compatible. As
we've mentioned above, if Spry triggers the call to
AC_FL_RunContent(), it will most likely be *after* the onload event
has fired, and since AC_FL_RunContent() uses document.write() it
will result in the entire page being overwritten by the
<object>/<embed> tag that it writes out.
That all said, libraries like SWFObject were designed to be
called even after the onload event fires, at least from what I can
tell from their samples. If you need to extract data from a data
set to create your SWFObject, you can simply attach an observer to
your data set that will tell the swfobject to do what it is you
want it to do. For example:
<script type="text/javascript">
var dsProducts = new Spry.Data.XMLDataSet("products.xml",
"/products/product");
// Register an observer on dsProducts so that any time it
changes data or the current
// row changes, it tells the swfobject what to do:
dsProducts.addObserver(function(notificationType, notifier,
data)
if (notificationType != "onDataChanged" || notificationType
!= "onCurrentRowChanged")
return;
// Do something with the swfobject here:
var curRow = dsProducts.getCurrentRow();
// The following embedSWF call is only an example of how to
get the "productURL" column
// value for the current row and pass it to the swfobject.
The rest of the args, are left as names to
// show you what you should be passing.
swfobject.embedSWF(curRow.productURL, replaceElemIdStr,
widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj,
parObj, attObj);
</script>
--== Kin ==-- -
Cache of Spry.Utils.updateContent data?
So I have a need for a Tab system that pulls data from other
files to load into the tabs. Any links in those files will trigger
the file to load into the tab (think like an iframe, but no
iframes). If the link is to an external site it will work as
normal. The links in my outside files don't need any js, id or
class in them. Just normal html. With some help from the yahoo
event and dom library I was able to detect clicks and redirect
everything very nicely. Did I need to use YUI to do the event
listener? Not sure, it made it pretty easy and I am no JS expert. I
didn't see anything within spry to help in that regard.
Example Here:
http://dev.besavvy.com/Spry_P1_4_1214/samples/tabbedpanels/tabbed_panel_sample.htm
My trouble comes with caching of the files. It seems FF
caches my .html files but not .cfm ones. IE caches both. I can use
the cfheader tags to prevent the cache I am sure, but that doesn't
fix .html files. I know I can work around it but I wanted to check
here as I am not clear if there is an optional attribute or another
direction I should take. It would be very handy to have a :cache
true :cache false type of solution.Try:
Spry.Utils.updateContent('apDiv1',elTarget,null,{method:'POST'});
which I believe will cause it to use the browsers post
mechanism which never caches.
Or:
var ts = new Date();
Spry.Utils.updateContent('apDiv1',elTarget+'&TS='+ts.toString());
which will add a unique date string to the end of the url
being requested making the browser believe it is a new page
Oh if the page doesn't already have a query string change +
'&TS=' to + '?TS='
Regards,
Chris Phillips
Senior Application Developer
www.dealerpeak.com -
Spry:state="loading" for Spry.Utils.updateContent
It would be very handy to be able to use something like
spry:state="loading" for Spry.Utils.updateContent. Right now it
seems you can only use the :state="loading" for regions. Makes
sense but being able to activate the loading div while update
content is running would also be very handy. To that matter for
waiting for tabs to load, etc.Cool. Thanks for the reference, Andrew!
-
NOTE THAT THIS ONLY PERTAINS TO MOBILE VIEWING (tested on iPhone)
Hi, I have a SpryTabbedPanels widget within my index.html page, where clicking each tab calls Spry.Utils.updateContent() to load an html fragment into the body of the panel content. My index.html looks something like...
<html>
<head>
<!-- All the Spry includes are done here but left out for brevity -->
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<p>This is text that is effected by stylesheet.css</p>
<!-- The Spry tabbed panel widget is invoked here, but only the following line is pertinent -->
<li class="TabbedPanelsTab" tabindex="0" onclick="Spry.Utils.updateContent('frag','frag.html');">Code Fragment</li>
<!-- The rest of the code to close up the tabbed panels widget goes here -->
</body>
</html>
Then the frag.html code can be anything, and here I'll just say it's...
<p>This is a code fragment not affected by stylesheet.css</p>
Suppose then that I have the following style sheet called stylesheet.css...
p {
color:#FF0000;
If index.html is accessed in a web browser like Chrome, Safari, etc., this code will have the obvious effect of displaying:
This is text that is effected by stylesheet.css
This is a code fragment not affected by stylesheet.css
However, when mobile browsing, the style sheet is not carried over to the code fragment, so the default settings for the <p> tag are used, producing black text for the second sentence above, displaying:
This is text that is effected by stylesheet.css
This is a code fragment not affected by stylesheet.css
I've tried putting <html> and <head> tags with a link to stylesheet.css in frag.html, but nothing seems to work. Any help would be greatly appreciated!
ThanksI think that worked. I've been messing around for a long time trying to
figure it out myself watching tons of drop down tutorials. Should have
asked a long time ago... It was hard because I wasn't completing from
scratch and rather updating my current site. How could I give you the
location on the server easily?
Lamppa Manufacturing Inc.
Kuuma (Green) Furnaces & (Fantastic) Sauna Stoves
P.O.Box 422
Tower, MN 55790
www.lamppakuuma.com
facebook<http://www.facebook.com/pages/Lamppa-Manufacturing-Incorporated-Kuuma-Furnaces-Sauna-Stove s/215958785138157>
[email protected]
1-800-358-2049
218-753-2330
Maybe you are looking for
-
Assignment of Step type and CR step for MDG_S
Hi This is in continuaton for thread MDG_S workflow. I original issue which is for MDGS when I assigned WS543000005 to CR type and sumitted CR goes no where, As as per SWEL it shows No Reciver Found enen though GET_AGENT table is maintained. In anot
-
Stored function not returning result set unless recompiled
Hi, I have a strange situation going on with a basic Java (1.6.0.17) application talking to an Oracle 11g (11.2.0.1.0) database. Basically what is happening is that sometimes a stored function's return value (a result set) is not making it as far as
-
I cannot control volume using keypad or computer can anyone help me?
Could anyone help me with my problem of not being able to control the volume using the key pad or the computer?
-
Why does adobe camera raw keep saving images with the incorrect white balance?
I am having an issue when I edit images. here is the scenerio: I choose 50 Raw files and open them in Camera Raw. I edit each individually - many of them have different white balances. Once I have each image how I want them, I select all and click d
-
Flash player 14, Internet Explorer 11 and Windows 7 (x64)
It seems impossible to allow flash to run. Uninstall of version 14 and reinstalling Flash 13 solves the problem (but this isn't desirable). Need working Flash ! Any suggestions?