Spry Variables

Hi, I'm trying to create a calendar application with spry and
xml. I'm using 1 single dataset that uses 'choose' and 'when'
statements. I want the choose to be dynamic, is that possible?
For example, right now - the calendar is picking today's day
of the year, (ie, February 11, 2008 -> day #42) and so on.
Here's a code sample of what I have to explain better:
<div spry:choose="spry:choose">
<div spry:when="'{dayofyear}' == '42'" >
Is there a way to make that '42' become dynamic using
javascript or some other form?

var gtoday = document.write('<div style="display:none">
<cfset thisDay = #DatePart("y",
Now())#><cfoutput>#thisDay#</cfoutput></div>');
var gweek = document.write('<div style="display:none">
<cfset thisWeek = #DatePart("ww",
Now())#><cfoutput>#thisWeek#</cfoutput></div>');
var gmonth = document.write('<div style="display:none">
<cfset thisMonth = #DatePart("m",
Now())#><cfoutput>#thisMonth#</cfoutput></div>');
<div spry:when="'{dayofyear}' == '#thisDay#'" >

Similar Messages

  • Parsing dataset and spry variable

    Hi there,
    Some curiosity of mine, can we parse spry dataset and
    variable to another function? something like parsing a dataset so
    we can save a lot code, example:
    quote:
    function reload(dataSource){ //dataSource was spry data set
    object
    dataSource.loadData();
    dataSource.setCurrentRow(0);
    and parsing spry variable, example i want to use Google
    Visualization API
    quote:
    function drawGraph(dataSource){
    //preprocessing and loop code here... i dunno how to create
    it with spry
    data.setValue(x, y, '{dataSource::value1}');
    //end loop
    so we just parse dataset and loop until last variable value
    to draw graph
    thanks,
    Dels

    Thanks,
    That was i need, btw how about question no 1? say i want to
    do something with my multiple dataset, in this case change url and
    reloading data
    quote:
    reload(ds1, 'new1.xml'); //spry dataset
    reload(ds2, 'new2.xml'); //spry dataset
    function reload(dataSource,url){ //dataSource was spry data
    set object
    dataSource.setUrl(url);
    dataSource.loadData();
    dataSource.setCurrentRow(0);
    i have tried that and it couldn't work... (maybe because i
    tried to pass object into function)

  • How to pass spry {} variables to PHP query sentence?

    I am trying to integrate AJAX poll system to a spry data set.
    My goal is to dynamically generate a poll fom associated with the id no. of each data item.
    So, I need to pass a spry xml variable covered by { } to a PHP query sentence.
    How? Is there any existing Spry poll solution? Thanks.

    The following sentence has been inserted into my code, but it doesn't work:
    <span spry:if="'ds_RowCount' == '0'">No Data to Display</span>
    ====
    <div spry:region="ds1" class="SpotlightAndStacked">
      <div spry:repeat="ds1" class="SpotlightAndStackedRow">
        <div class="SpotlightContainer">
          <div class="SpotlightColumn"> Type:{type}</div>
          <div class="SpotlightColumn"> Title:{title}</div>
          <div class="SpotlightColumn"> Username:{username}</div>
        </div>
        <div class="StackedContainer">
          <div class="StackedColumn"> <img src="upPhoto/{image}" width="144" height="144"/></div>
        </div>
        <br style="clear:both; line-height: 0px" />
      </div>
    <span spry:if="'ds_RowCount' == '0'">No Data to Display</span>
    </div>
    ====

  • Can anybody help me up? Spry variable heights?

    Hey everybody!
    I need help!
    I would like to make on a Spry Accordion variable heights...
    Actually it shoudl look exactly like this one...
    http://labs.adobe.com/technologies/spry/samples/accordion/AccordionSample.html#VariablePan elHeights
    But where the hell should I paste/replace it? I tried already
    everything...TT
    I am using AdobeDreamweaver CS3
    The code looks as follow when I dont change anything...
    quote:
    @charset "UTF-8";
    /* SpryAccordion.css - Revision: Spry Preview Release 1.4 */
    /* Copyright (c) 2006. Adobe Systems Incorporated. All rights
    reserved. */
    /* This is the selector for the main Accordion container. For
    our default style,
    * we draw borders on the left, right, and bottom. The top
    border of the Accordion
    * will be rendered by the first AccordionPanelTab which
    never moves.
    * If you want to constrain the width of the Accordion
    widget, set a width on
    * the Accordion container. By default, our accordion expands
    horizontally to fill
    * up available space.
    * The name of the class ("Accordion") used in this selector
    is not necessary
    * to make the widget function. You can use any class name
    you want to style the
    * Accordion container.
    .Accordion {
    border-left: solid 1px gray;
    border-right: solid 1px black;
    border-bottom: solid 1px gray;
    overflow: hidden;
    /* This is the selector for the AccordionPanel container
    which houses the
    * panel tab and a panel content area. It doesn't render
    visually, but we
    * make sure that it has zero margin and padding.
    * The name of the class ("AccordionPanel") used in this
    selector is not necessary
    * to make the widget function. You can use any class name
    you want to style an
    * accordion panel container.
    .AccordionPanel {
    margin: 0px;
    padding: 0px;
    /* This is the selector for the AccordionPanelTab. This
    container houses
    * the title for the panel. This is also the container that
    the user clicks
    * on to open a specific panel.
    * The name of the class ("AccordionPanelTab") used in this
    selector is not necessary
    * to make the widget function. You can use any class name
    you want to style an
    * accordion panel tab container.
    .AccordionPanelTab {
    background-color: #CCCCCC;
    border-top: solid 1px black;
    border-bottom: solid 1px gray;
    margin: 0px;
    padding: 2px;
    cursor: pointer;
    -moz-user-select: none;
    -khtml-user-select: none;
    /* This is the selector for a Panel's Content area. It's
    important to note that
    * you should never put any padding on the panel's content
    area if you plan to
    * use the Accordions panel animations. Placing a non-zero
    padding on the content
    * area can cause the accordion to abruptly grow in height
    while the panels animate.
    * Anyone who styles an Accordion *MUST* specify a height on
    the Accordion Panel
    * Content container.
    * The name of the class ("AccordionPanelContent") used in
    this selector is not necessary
    * to make the widget function. You can use any class name
    you want to style an
    * accordion panel content container.
    .AccordionPanelContent {
    overflow: auto;
    margin: 0px;
    padding: 0px;
    height: 200px;
    /* This is an example of how to change the appearance of the
    panel tab that is
    * currently open. The class "AccordionPanelOpen" is
    programatically added and removed
    * from panels as the user clicks on the tabs within the
    Accordion.
    .AccordionPanelOpen .AccordionPanelTab {
    background-color: #EEEEEE;
    /* This is an example of how to change the appearance of the
    panel tab as the
    * mouse hovers over it. The class "AccordionPanelTabHover"
    is programatically added
    * and removed from panel tab containers as the mouse enters
    and exits the tab container.
    .AccordionPanelTabHover {
    color: #555555;
    .AccordionPanelOpen .AccordionPanelTabHover {
    color: #555555;
    /* This is an example of how to change the appearance of all
    the panel tabs when the
    * Accordion has focus. The "AccordionFocused" class is
    programatically added and removed
    * whenever the Accordion gains or loses keyboard focus.
    .AccordionFocused .AccordionPanelTab {
    background-color: #3399FF;
    /* This is an example of how to change the appearance of the
    panel tab that is
    * currently open when the Accordion has focus.
    .AccordionFocused .AccordionPanelOpen .AccordionPanelTab {
    background-color: #33CCFF;
    Can anybody give me a piece of advice, I dont know what to
    do!!
    thanks anyway!!

    thanks for your answer!
    I didnt know that you must add it into the html file.
    I opened the SpryAccordion.js file and I changed it right
    away
    you had to change only the "true" into "false" that works
    too!
    And I was so consufed because when I clicked on "customize
    this widget" there was everywhere written to open the CSS. file.
    but thats only for the colour etc.
    Very unclearly written and moreover on this page
    http://labs.adobe.com/technologies/spry/samples/accordion/AccordionSample.html#VariablePan elHeights
    No where was written I have to add it into my html file as
    well.
    I have read it now the first time in your post!! so anyway...
    There is something I'd like to know, too!
    I would be pleased if you could tell me whether it is
    possibly to have two or more different
    Spy Accordions at the same html file!

  • Newb: Passing a spry variable into an onClick function?

    So I have a spry table that's populating great and everything is working fine. I want to add the ability to run a simple function when a row is clicked.
    The code I've written...
    <tr spry:repeat="ds1" spry:hover="hover" spry:select="selected" onClick="DoNav({@name})">
    Here's the function...
    function DoNav(theLocation){      alert(theLocation); } 
    When I click the row nothing appears to happen but Firefox's error console returns an error: "Error: ThisNodesLocation is not defined"
    "ThisNodesLocation" is the value of @name in this instance.
    Any help would be greatly appreciated.
    Thanks.

    onClick="DoNav('{@name}')"
    You should wrap it in strings like i did above

  • Using spry in header

    I'm trying to place a spry variable inside my header in a portion of javascript code.
          var data = new google.visualization.DataTable();
          data.addColumn('string', 'Topping');
          data.addColumn('number', 'Visits');
          data.addRows([
            ['Never Visited', {ds1::zero}],  <-------------spry variable
            ['One Visit', 1],
            ['Two Visits', 1],
            ['Three Visits', 1],
            ['More than Four Visits', 2]
    the code doesn't work when I add the variable as shown above. How could I get my spry variable to work within my header as shown above.

    The Spry markup you are using is only for the HTML in the body section, not for inside Javascript sections.  You'll need to add an observer to the spry dataset and then build your Google data table in the Spry Data onload event,

  • IE bug - onclick in repeat region

    So, it took me most of the day to track this down.
    I have a repeat region that is setting an onclick and the
    page was throwing a JS error in IE6 and IE7.
    But, after it threw the error everything worked including the
    onclick.
    I finally figured out that it worked if I changed this:
    onclick="alert({modelid});"
    To this:
    onclick="alert('{modelid}');"
    I had to surround the spry variable notation with
    single-quotes.
    The reason I hadn't done this to begin with is that I have an
    integer in that field, so it's unnecessary.
    I'd be happy to send any Adobe employee the file that I
    created to demonstrate the problem.
    If the single quotes are always necessary, then that should
    be prominent in the instructions.
    If not (and they shouldn't be), then I look forward to this
    being fixed in the .4 release.
    Keep up the good work guys. Spry really is impressive (when
    IE, in all it's suckitude, isn't murdering it)

    Hi cf_addict,
    This is a known problem, so you are absolutely correct that
    it should be something we warn folks about up-front. Don and I have
    had some discussions about putting together a common problems page
    and posting it on labs and including it in the next version of
    Spry.
    For the curious, it looks like IE pre-compiles the JS in on*
    event attributes, so it barfs on unquoted data references because
    it thinks it's a syntax error. Quoting the data reference prevents
    the problem, and because JS does a lot of auto-coercing of types,
    things just work most of the time.
    --== Kin ==--

  • NestedXMLDataSet and Javascript

    I am trying to pass the values of a nested XML data set off
    to a JavaScript function, but I cannot figure out how the format
    would work for the life of me. This is what I am currently trying
    to do.
    var modules = new Spry.Data.XMLDataSet("testData2.xml",
    "form/module");
    var formFields = new Spry.Data.NestedXMLDataSet(modules,
    "field");
    <div spry:region="modules formFields">
    <div spry:repeat="modules">
    <div>{modules::name}</div>
    <div spry:repeat="formFields" id={modules::id}>
    <script type="text/javascript">
    <!--
    window.setTimeout('testFunction(formFields:title,formFields:type)',
    500);
    //-->
    </script>
    </div>
    </div>
    </div>
    Does anyone know an easy way to pass the Spry variable stuff
    into the javascript?
    Alternatively, I was trying to get the dataset into
    javascript by running a var formFieldsData = formFields.getData();,
    but I only get the first set of data, repeated over and over. It
    doesn't seem to want to step through the other iterations of the
    nexted XML dataset.

    Spry doesnt change the scripts that are in the region, it
    just calls them when the region updates it.
    Also, did u try to loop through the nested data that got
    returned by the getData?

  • Combining data?

    What am I doing wrong here?
    <tr spry:repeat="guild_members" spry:odd="row_1"
    spry:even="row_2" spry:hover="row_hover">
    <td>{@name}</td>
    <td>{@level}</td>
    <td ><img
    src="images/icons/race/{@raceId}-{@genderId}.gif"></td>
    <!-- FAILS -->
    <td>{@class}</td>
    <td>{@rank}</td>
    </tr>

    I believe that you can't just combine spry variables; you
    need extend your dataset by creating "custom columns" immediately
    after you load it. Seems like a pain, but it's not really that
    hard. See the documentation here:
    http://labs.adobe.com/technologies/spry/samples/data_region/CustomColumnsSample.html

  • Using a variable in Spry conditional tests included in a Spry Tooltip

    I have the following code:
    <div spry:region="company" id="tooltip">
    <div spry:repeat="company" spry:choose="spry:choose">
    <div spry:when="'{name}'==memberName">
    <table>
    <tr>
    <td
    align="center"><h2>{name}</h2></td>
    </tr>
    <tr>
    <td align="center"><img src="{headshot}"
    alt="{name}" width="227" height="350" /></td>
    </tr>
    <tr>
    <td align="center">{description}</td>
    </tr>
    </table>
    </div>
    </div>
    </div>
    <script type="text/javascript">
    var tooltip_trigger_one = new
    Spry.Widget.Tooltip("tooltip","#trigger", {showDelay: 200,
    hideDelay: 200, offsetX: 250, offsetY: 200} );
    </script>
    where the variable "memberName" is set elsewhere to a value
    that matches one of the occurrences in the column "name" in the
    dataset "company". I can see, using debugging tools, that the
    variable is being set correctly. But.... when the tooltip is
    triggered, only a small few-pixel square box opens up.
    If, instead of using the variable "memberName" in:
    <div spry:when="'{name}'==memberName">
    I use a string, as in
    <div spry:when="'{name}'=='John Doe'">
    then the code works correctly and I get a large tootlip
    showing me the correct information for that member of the company.
    I have tried different tests (spry:if and spry:test for
    instance), tried various combinations of quotes and parenthesis and
    tried placing the code at various places both inside and outside of
    the <body> -- but always get the same results.
    Is it not possible to test against a variable or am I doing
    something else incorrectly?
    Thanks,
    Janet

    OK.... some progress to report.
    I was setting memberName onmouseover-- which is also the
    trigger for the tooltip-- thusly:
    <p><em onmouseover="memberName='John Doe'"
    id="trigger">John Doe</em></p>
    It seems that the variable is being set, but too late, as the
    trigger has already caused the div... id="tooltip"> to be
    evaluated with "memberName" not equal to any of the names in the
    dataset. I tried using a function call to set "memberName" and
    tried putting the onmouseover in the <p> tag and leaving the
    trigger id in the <em> tag. but neither of those appear to
    change the outcome. "memberName" still appears to be set to the
    value I initialized it to up the the <head> section at the
    time the tooltip <div> is evaluated. Although it is set
    correctly if I check it's value using Firebug after I have
    mouse-overed it.
    Incidentally, using a Firebug breakpoint just before the
    <div spry:when...> and checking the value of memberName was
    how I discovered that "memberName" still seemed to have a value of
    "initialized" which is what I set it to up in the <head>
    section.
    Having written all of this, I am wondering though, shouldn't
    the value of "memberName" be equal to "John Doe" the second time I
    mouseover it? Or, if there are more than one trigger "names" on the
    page, shouldn't "memberName" be equal to the name of the previous
    trigger that I moused-over? And with memberName having a legitimate
    value at that point, shouldn't the tooltip now show the correct
    display information rather than just that little few pixel square
    box that I am getting when I mouse-over the trigger name?
    Clearly there is something that I just am not understanding.
    Janet

  • Using Spry Data Set Variable in Recordset

    I have a page that contains a spry data set and a recordset. The recordset uses one of the variables from the spry data set to filter its results. how do I apply the spry data set variable to the recordset?

    I believe passing this the variable through the URL requires you to update the page, right?
    Yes
    Is there anyway to grab the spry data set variable direct and apply it to your recordset filter?
    The SpryDataSet variable can only be used on the clientside (JavaScript) so you will have to get your recordset using JS.
    A page refresh can be set in motion if you add {useCache: false, loadInterval: 500} to your dataset to then set an observer to your dataset to invoke the page refreash function.
    Gramps

  • URL variable in Spry Dataset

    Hi guys, first time posting with a pain-in-the-bum problem i have been trying to figure out all day.
    I want to display certain records in my xml file depending on a link being clicked on a previous page. Below is my current code:
    // Create variable is_input to see if there is a # in the url
    is_input = document.URL.indexOf('#');
    // Check the position of the # in the url
    if (is_input != -1)
    // Create variable from # in the url to the end of the string
    addr_str = document.URL.substring(is_input+1, document.URL.length);
    // Loop through the url and write out values found
    // or a line break to seperate values by the &
    for (count = 0; count < addr_str.length; count++)
    if (addr_str.charAt(count) == "&")
    // Write a line break for each & found
    {document.write ("<br>");
    }else{
    url_variable = (addr_str.charAt(count));
    // Write the part of the url
    document.write (url_variable);
    }else{
    document.write("No values detected");
    var dsGlossary = new Spry.Data.XMLDataSet("glossary1.xml", "glossary/glossary_term[glossary_term_heading = url_variable]");
    If you look at my dataset string you will see a variable called url_variable - i want to match records where url_variable = glossary_term_heading. I can write out url_variable to the page using document.write (url_variable); but cannot format it in such a way as for it to work within the dataset string.
    Any help would be greatly appreciated!

    Hi guys, me again. I just had a look at my post above and thought maybe i was waffling a bit. To summarise, all i want to do is have the dataset "dsGlossary" read the javascript variable. "url_variable" so i can match that with "glossary_term_heading" (a field in my XML file).
    Again, thanks in advance for your replies.

  • Using javascript variable in spry if statement

    is it possible to put a javascript variable in to the spry if
    statement to test?
    like <div spry:if="javascriptvar == {ds_RowNumber}"....
    thanks.

    Hi rogerfreak,
    When the region processes a spry:if, it simply takes the
    value of the spry:if attribute, replaces all of the data references
    in it with real values from the data set and then evals the result
    (executes the string).
    So you can do something like:
    <script>
    var ds1 = new Spry.Data.XMLDataSet("foo.xml", "/foo/bar");
    var gMode = 5;
    function GetMode()
    return gMode;
    </script>
    <div spry:region="ds1">
    <ul spry:if="gMode == 5">
    <li spry:repeat="ds1">{name}</li>
    </ul>
    <div spry:if="gMode == 12" spry:repeatchildren="ds1">
    {name}
    </div>
    </div>
    In the example above the list markup will be written out if
    gMode is 5, but if it is 12, it will write out the div markup.
    You can also call functions:
    <div spry:region="ds1">
    <ul spry:if="GetMode() == 5">
    <li spry:repeat="ds1">{name}</li>
    </ul>
    <div spry:if="GetMode()== 12"
    spry:repeatchildren="ds1">
    {name}
    </div>
    </div>
    --== Kin ==--

  • SPRY accoridian variable Panel Heights

    Hi,
    I have used Accordion panels on one of the page. Content of
    the panels are of different length so I have made it variable
    height by " useFixedPanelHeights: false" . When I preview in the
    browser all the panels are variable length but I still get scroll
    bar on few panels. The scroll bar is for may be 1 or 2 lines only.
    for example one of my panel is about 275px in height and I
    get scroll bar of 1-2 lines. Other panel is 600px in height and I
    still get scroll bar of 1-2 lines only. I think it happens when my
    list has more than 3 bullets points inside the panel.
    Can someone please help?
    Thanks!

    Hi Donald, I inserted <script type="text/javascript">
    var acc1 = new Spry.Widget.Accordion("Acc1", {
    useFixedPanelHeights: false });
    </script> into my code. It's almost there, but not
    quite. I can see that it is trying to re-ajust the panels' height,
    but for panels that have a larger content it tends to show the
    whole panel's content and then hides the half of it. Also for
    panels with fewer content it doesn't seem to have an effect at all.
    I don't know if I have to fix something in the CSS or place the
    Acc1 ID in a different location within my accordion HTML code.
    Thank you.
    Here's the URL I'm working on if you want to take a look.
    http://64.49.218.100/product_p/00-120-0ll.htm

  • Spry XML data set and dynamic post variables

    Hi,
    I am trying to create an XML data set that has dynamic post
    variables.
    Everytime something is pressed on the page a variable changes
    and I then want to reload the XML data set using the new variable.
    I know I can just pull in an XML with all possible variables
    and filter client side but this would make it way too large.
    Does anyone know what I may need to do.
    I tried this:
    var myVar = 0;
    var dss = new Spry.Data.XMLDataSet (
    '../../cgi-bin/server_details.pl' , 'top' , { method: 'POST' ,
    postData: sid=ajaja21&ip=127.0.0.1&cid=' . myVar ,
    subPaths: [ "auth" , "plugins" , "plugins/plugin" ] , keepSorted:
    "true", sortOnLoad: "plugins/plugin/order", sortOrderOnLoad:
    "descending", useCache: false, loadInterval: 10000 } );
    onclick="myVar=1";
    But the script doesn't understand the post variables sent (it
    does when I remove the . myVar part and put in a static value). I
    think it isn't sending that dynamic variable with the post
    variables.
    Any ideas anyone?
    Thanks

    Well I had it working when I stripped back everything and
    just had the dss data set and a single onclick function, but now
    that I put it back together it hash foobared again.
    Here are the relevant bits of code that I've changed.
    The function to change server id:
    //function to run when changing the server id
    function changeServer ( sid ) {
    //set the url to use the current server id
    dss.setURL = ( '../../cgi-bin/server_details.pl' , { method:
    'POST' , postData:
    'sid=7gv1m3vjvagfl7h7qeefb8iodj8evhmb&ip=127.0.0.1&cid='+sid
    //force a reload of the server data
    dss.loadData();
    The inital load of the data set
    var dss = new Spry.Data.XMLDataSet (
    '../../cgi-bin/server_details.pl' , 'yams' , { method: 'POST' ,
    postData:
    'sid=7gv1m3vjvagfl7h7qeefb8iodj8evhmb&ip=127.0.0.1&cid=0' ,
    subPaths: [ "auth" , "plugins" , "plugins/plugin" ] , keepSorted:
    "true", sortOnLoad: "plugins/plugin/order", sortOrderOnLoad:
    "descending", useCache: false, loadInterval: 10000 } );
    And the part that changes the server id
    <td align="left" style="cursor:default; width:174px;"
    onclick="changeServer({dsv::servers/server/@id})">{dsv::servers/server/name}</td>
    I checked that the function is receiving the correct server
    id and I even tried hard coding the cid variable to 2 in the change
    function but it still wasn't changing on the server side.
    Any ideas?
    Thanks

Maybe you are looking for