Elapsed Time delay only works once in state machine

Hello.  I'm having problems using the elapsed time delay to show the seconds remaining on a wait step in a simple state machine.  I would like to have a front panel count down showing the time left for the step.  I thought the elapsed time delay was the way to do this.  The problem is the vi runs correctly the first time through.  But then after that the timing does not seem to reset back to the times I had set.  If I remove the elapsed time delay and just stick a wait time in the state, the vi runs as I would expect.  This just doesn't give the user an idea of the time remaining.  What am I missing when using the elapsed time delay, or is this just the wrong tool for the job?
A smaller issue is that I would like to move the tasks, in this case the LED's outside the loop so I don't have to repeat code.  But when I tried moving them outside with only leaving the constants inside the state they did not work as I expected.  If you have tasks like the operation of a set of booleans that you are used in several states, what is the cleanest way to do this without repeating code?
Thanks for the help.
Danny
Solved!
Go to Solution.
Attachments:
Elapsed Time Delay.vi ‏39 KB

The problem is that the Auto Reset on the express VI resets the start time of the timer as soon as the time has completed.  So you are essentially restarting the #1 timer immediately and then go on to #2.  Once #2 is completed, #1 has already passed 10 seconds as well.
What you need to do is use the reset input for the express VI, but only have that be true the first time it is called.  By using a shift register and the implies function on those loops, you can do that.
As for the duplication of states, don't have a state 1 and a state 2.  Just have a Run state.  Use a shift register to maintain a value for what your next state will be and a case structure to based on that to show what booleans should be lit and what the next state will be.
Message Edited by Ravens Fan on 06-12-2009 10:56 AM
Attachments:
Example_VI_BD.png ‏2 KB

Similar Messages

  • Pinch zoom-in/out only works once in Safai

    Outside of Safari, the pinch gesture works normally. In Preview it will zoom in or out as deep as I need. But when I try and use the gesture in Safari, it will only work once until I 'CMD' + '0' or click "Actual Size" in the View tab. It doesn't zoom on a gradient either. Pinch-open is the equivalent of 'CMD' + '+' and pinch-close is the the equivalent of 'CMD' + '-'. After I make the gesture once, I can pinch all I want and nothing happens. I need to revert the page to its original size for the gesture to work again (still only once).
    I have an i7 Macbook Pro running 10.6.8. Can anybody help me out?

    Sorry, I didnt do a good enough job explaining my issue/bug above. I can't attach a screen shot becuase of where I work and what this content is so I will do the best I can explaining it in text.
    I have a row of buttons created in InDesign that have no effects, no rollovers and lets just call them Apple In, Apple Out, Orange In, Orange Out, Banana In, Banana Out, etc.
    The Apple In button invokes an animation called Apple Fade In. Apple Out simply fades out the content animation. All of the other buttons function the same way. In my exported .swf I can click Apple In and I get my content as expected, I click Apple Out and away it goes. All other buttons work the same way, as expected. If I go through all my fruit and now I want to go back and display the Apples again. I click Apple In and NOTHING happens! If I click Apple Out the fade out animation works just fine, as many times as I want to click it, I get a flash of the content and it fades right out. The "In" buttons no longer work for any of the fruit after the initial "In" animation plays.
    In the Animation Panel I have the animations set to Play Once and Dont Hide. In the Layers Panel I have a layer called Apple Fade. In that Layer Group/Set I have Apple Fade Hack which consists of a native ID square no stroke and no fill grouped with my Apple content on "the stage." Also in that Layer Group/ Set is a collection of bitmap images, text, and vectors called Apple. I created the content first on a layer Apple, when I created the group with the blank square ID bumped the original content group under the parent layer and added another sub-layer called Apple Fade Hack. These two are indented and under the top level Apple Layer. I could probably get away with attaching a screen shot of the timing, layer, and animation panels if I had to.
    Thanks

  • Command Windows.open only works once

    Hi all,
    Iu2019m using javascript command window.open to open a new browser window from a html link webui and is working fine.
    The issue I have is this only works once. If you close the window that you had opened, and click again in the link it doesnu2019t work. It only works if you call another link before. It seems there is a kind of cache in somewhere.
    Do you have any idea?
    Thanks in advance.
    Fernando.-

    Fernando,
      Change ur mywindow name every time.Kindly go through following code. 
    CALL FUNCTION 'GENERAL_GET_RANDOM_STRING'
      EXPORTING
      number_chars        = 3
      IMPORTING
      RANDOM_STRING       = mywindow
    var lr_window;
    lr_window = window.open("<%= lv_id%>","<%= mywindow%>","resizable=1,width=1100,height=674,fullscreen=yes");
    if (window.focus)
    {lr_window.focus()}
    lr_window.moveTo(0, 0);
    <%
      clear lv_id.
    %>
    <%-- delete lv_window; --%>
    <%-- mywindow.close(); --%>
    <%
      endif.

  • JCOM only works once

    I have a web application that was originally developed using J-Integra
    1.5.3 -- it works great in tomcat 4.1, and the classes themselves can
    also be tested/exercised outside of tomcat, where they work perfectly
    as well.
    Now that the application is mostly finished with development, we want
    to deploy this to our BEA Weblogic 8.1 servers. The problem
    is that, after turning on JCOM, and removing the external jintegra
    jars (using only the weblogic versions now), I can get the app to
    work properly exactly once after startup. That is, I can start
    Weblogic, load the JSP page I use as a tester in my browser, and it
    works as it should. If I hit the refresh button, I get a
    RuntimeException like this:
    java.lang.RuntimeException:
         at com.linar.jintegra.StdObjRef.invoke(StdObjRef.java:55)
         at com.linar.jintegra.Dispatch.vtblInvoke(Dispatch.java:763)
         at jsp_servlet.__index._jspService(__index.java:181)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
         at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
    tStubImpl.java:1053)
         at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :387)
         at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :305)
         at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
    ebAppServletContext.java:6291)
         at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
    t.java:317)
         at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:97)
         at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
    ntext.java:3575)
         at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
    :2573)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)
    I also see this in my weblogic logs:
    <Jul 8, 2003 2:14:05 PM EDT> <Error> <COM> <BEA-210000> <100680] *: >
    and thats all the information I get.. I have tried to crank up the
    jintegra logging as high as I can (using both "
    com.linar.jintegra.Log.logImmediately(3, "c:\\temp\\jintegra.log");
    " in the constructor, and by supplying
    "-DJINTEGRA_LOG_FILE="c:\temp\jintegra2.log" -DJINTEGRA_LOG_LEVEL=3"
    on the startup line for weblogic, but gotten only as far as
    c:\temp\jintegra.log being created.. no contents in it, and
    jintegra2.log (the one created from the command line) isnt created at all.
    so, I am at a loss... it does work once, and I absolutely no
    information as to why it fails after that first time. Any ideas would
    be appreciated. thanks.

    not sure exactly why it would only work once, but I
    personally dont like using a listener for simple button actions.
    If it were me, i would just use standard button actions and
    make the caption fade in and out with an alpha tween.

  • Time Capsule only works for one device at a time, how to make it capable to be used for multiple devices at times

    Time Capsule only works for one device at a time, how to make it capable to be used for multiple devices at times.
    Please help to set it up, thanks in advance

    You need to give more info..
    Firstly only works for what.. networking.. backup.. wireless. You need more nouns.. more adjectives... describe what you want and what fails.. then we can figure out why.
    Most likely you have bridged it when it should be in router mode..
    Most likely you are using Lion or ML which has the airport utility bridge the TC by default.
    Change it to working as a router. That might help.
    If you press reset button it will default back to router btw.
    If you are on Lion.. use a real utility. http://support.apple.com/kb/DL1547

  • For some reason, I can not delete bookmarks. I did one at a time, then tried 5 or 6 and it worked once then no more. I then tried 1 at a time and it worked once the no more. This is a brand new computer (Win7) and FF just loaded about 3 hours ago.

    # Question
    For some reason, I can not delete bookmarks. I did one at a time, then tried 5 or 6 and it worked once then no more. I then tried 1 at a time and it worked once the no more. Why is this happening? This is a brand new computer (Win7) and FF just loaded about 3 hours ago. Do not know how the bookmarks even got in there. Some were ok, but no order and some that were never bookmarks. Looks like FF tried to import some BM's from the Virtual XP installed, but did not get it any where near right. I need to completely delete all of them and install from a saved .html file.

    Well, I did not see the exact problem that I was having listed in the articles, BUT the problem is solved for now.
    I opened FF and the Bookmarks to Organize again. I deleted all of the folders and entries, ONE AT A TIME, AND IT WORKED. Evidently, for what ever reason, FF did not like "Batch" deletes of ANY amount greater than 1 and the HANG UP would occur.
    Deleting one at a time then importing the good .html from a good file, loaded the wanted Bookmarks. Yea

  • Event only works once

    Hi all!
       I'm trying to do a movieclip that has 2 buttons that change the content of a flvplayer.
       The problem is that the buttons only work once, after that the event listener isn't triggered (I think) I have no removeEventListener in my code for those events so I'm totally lost as to why is this happening.
       My code is this:
    stop();
    var correr:Boolean = true;
    Globals.vars.videoP = CM_player;
    SnowManInst.addEventListener(MouseEvent.MOUSE_DOWN, mudarVideo_SM);
    bananaKingInst.addEventListener(MouseEvent.MOUSE_DOWN, mudarVideo_BK);
    addEventListener(MouseEvent.MOUSE_DOWN, pararFilme);
    function pararFilme(e1:MouseEvent){
        trace("pararFilme "+Globals.vars.videoP);
        Globals.vars.videoP.stop();
        correr = false;
        removeEventListener(MouseEvent.MOUSE_DOWN, pararFilme);
        addEventListener(MouseEvent.MOUSE_DOWN, correrFilme);
    function correrFilme(e1:MouseEvent){
        trace("correrFilme");
        Globals.vars.videoP.play();
        correr = true;
        removeEventListener(MouseEvent.MOUSE_DOWN, correrFilme);
        addEventListener(MouseEvent.MOUSE_DOWN, pararFilme);
    function mudarVideo_BK(e1:MouseEvent){
        trace("mudar video BK");
        Globals.vars.videoP.stop();   
        gotoAndStop(2);
    function mudarVideo_SM(e1:MouseEvent){
        trace("mudarVideo_SM");
        Globals.vars.videoP.stop();   
        gotoAndStop(3);
    Any help would be greatly appreciated.

    it's not clear what you're trying to accomplish with that code but there are a few reasons that might fail.
    to starty, you should understand that first a button event is dispatched, then a main timeline event is dispatched (and the main timeline listener toggles between two listener functions) and finally you go to a different frame and any code in the other frame is executed.
    so, that's a pretty screwy setup.  you should remove the main timeline listeners and their functions and it's not clear you need to direct the main timeline to another frame.

  • Spry Tab link only works once... why?

    Hi all,
    I have a spry tabbed area with 4 tabs on my page. Each tab contains data that is dragged from an MSAccess table. A couple of the tabs have repeat regions. This all works fine.  One of my tabs has a repeat region where I can click on a button image to change a record status from True to False (or visa versa). The click runs the associated vbscript which executes the SQL update statement no problem. However I noticed that when I changed the data on this tab and reloaded the page using a Response.redirect after the sql update was executed, it would default to the 1st tab and not the one I was viewing that contains the repeat region. A quick search led me to the SpryURLUtils.js file which solved that problem by allowing me to specify which tab to load. I appended the relevant code to give me this:
    Response.Redirect("myrecord.asp?" & Request.QueryString & "&tab=1#TabbedPanels1"
    As I mentioned, the tab contains a repeat region. If I click on a button to change the status of that record the page reloads fine and displays the correct tab. But this only happens once... each subsequent time I try to change another record my tab contents disappear. The tabs are still visible and if I click on the tab where I've changed the data the tab content is dispalayed, but obvioulsy this isn't right... it should reload and display the correct tab with each call of the code.If I navigate away from this page and then come back to it I can successfully chnage one record and the results are displayed. Change another record and the changes are made, but the tab contents are not displayed again. The interesting thing is that if I reload/refresh the page the problem occurs staright away on the first record change.
    So my question is 2-fold... Why is this happening and how do I solve the problem?
    Here is the vbscript that updates the record and  does the Response.redirect
    <%
    'Change Notification
    If (CStr(Request("ToggleNotify")) = "ToggleNotify") Then
    dim strSQL
    'check to see if notification is currently true or false
        If cstr(Request.Form("NotifyChanges")) = Cstr("True") Then
        'change notifiaction to false
            strSQL = "UPDATE tblUserAccess SET NotifyChanges=0 WHERE AccessID = " & Request.Form("hiddenAccessID")
        else
            strSQL = "UPDATE tblUserAccess SET NotifyChanges=-1 WHERE AccessID = " & Request.Form("hiddenAccessID")
        end if
        Set MM_editCmd = Server.CreateObject ("ADODB.Command")
        MM_editCmd.ActiveConnection = MM_VBUsers_STRING
        MM_editCmd.CommandText = strSQL
        MM_editCmd.Execute
        MM_editCmd.ActiveConnection.Close
        Response.Redirect("myrecord.asp?" & Request.QueryString & "&tab=1#TabbedPanels1" )
    End If
    %>
    Here is my Repeat region with the associated form
    <%
    While ((Repeat3__numRows <> 0) AND (NOT rsAccessRights.EOF))
    %>
    <form name="frmNotifications" method="post" action="">
      <tr class="PageText">
        <td width="200"><%=(rsAccessRights.Fields.Item("SectionTitle").Value)%>
            <input type="hidden" name="hiddenAccessID" id="hiddenField2" value="<%=(rsAccessRights.Fields.Item("AccessID").Value)%>">
        </td>
        <td width="200">
                    <%If (CStr((rsAccessRights.Fields.Item("NotifyChanges").Value)) = CStr("True")) Then %>
              <input type="image" src="../sitegraphics/accept.png" alt="Submit button">
            <%else%>
              <input type="image" src="../sitegraphics/cross.png" alt="Submit button">
            <%end if%>
        <input type="hidden" name="ToggleNotify" value="ToggleNotify">
        <input type="hidden" name="NotifyChanges" id="test" value="<%=cstr((rsAccessRights.Fields.Item("NotifyChanges").Value))%>">
       </td>
    </tr>
    </form>
      <%
      Repeat3__index=Repeat3__index+1
      Repeat3__numRows=Repeat3__numRows-1
      rsAccessRights.MoveNext()
    Wend
    %>
    And here is the bit at the bottom that specifies the default tab if nothing is passed in the URL
    <script type="text/javascript">
    <!--
    var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1", {defaultTab: params.tab ? params.tab : 0});
    //-->
    </script>
    Sorry for the long post!
    This is my first dabble with Spry stuff, so I'm a bit green. If anyone can explain to me why this is happening that would be most apopreciated. If anyone can tell me how to solve the problem I'll send them a big e-kiss!
    Not sure how impotant this is but it happens in both Firefox and IE8.
    Thanks in advance
    Dan

    Hi Ben, thanks for taking the time to read my query.
    The site in question is an intranet site, so I am unable to give you a link to the page. Would the entire page of code rather than just the odd bits help?
    Cheers
    Dan

  • CallResponder CREATE only work once

    Hi all!
    Im using Flash Builder 4 to create a new project. Im really happy with the new connection methods, but Im getting an issue really strange. When i create a new service call that include data in my base, it only works on the first time! When i try to include another value, it simply dont work. I dont receive any error message, alert.... nothing. Is there anybody that had this problem? any idea to fix it?
    Explaining the issue in example: I create a Employee service. I generated the employee form, and associated it with the CreateEmployee service. I fill the form with the employee data, and submit. It include the data on my database correctly, but when i try to input another data, the button just dont work. I have to refresh the page to it work again. I tryed to find some answer on the web, but until now i didnt find it. I know that FB4 has been released very recently, so we dont have already a huge knolegment on it.
    Thanks,
    Williams

    Hi,
    I haven't worked a lot with the data wizards but one thing I notice is when you set a form to create a record it will produce a very standard template that uses a valueobject of 'name'. Now on the assumption that you have a new record you wish to enter, the first step is not to try and edit any automatically generated primary keys
    i.e. a mysql table
      ID = int (autoincrement) primary key
      Surname = varchar(25)
      Name = varchar(25)
      DOB = date; 
    the form template would offer all these fields for updating/creating) - so delete the ID option as you don't want to touch that
    Next with the value object once its populated it would possibly update the existing record rather than create a new one so when you enter your create option reseting the value object would be a good idea -  names = new Names(); this gives you a clear object for the create record process.
    Last thing, if you are displaying the records in a grid you would refetch the records in an eventlistener for the createrecord function.
    If you would like a test case for this let me know and i'll put something together.
    David

  • My Airport Time Capsule only works when I turn off and turn on, but I think this may end up with the unit. What can this happening and how to solve?

    Time Capsule Airport
    Hello to all, good day, sorry my english google, but it is the tool I have at the moment. I'm having trouble with my Time Capsule Airport, I made all the settings according to the manual, but there has been a connection problem with my iMac. When I finish my work I turn off the imac and then again when they return to work and care, it can not connect to Time Capsule Airport, making it impossible to remove the files and make back up by Time Machine only works when I turn off and turn on the Airport Time Capsule , but I think this may end up with the unit. What can this happening and how to solve? Thank you.
    Olá a todos, bom dia, desculpe meu inglês google, mas é a ferramenta que tenho no momento. Estou tendo dificuldades com a minha Airport Time Capsule, fiz todas as configurações de acordo com o manual, mas tem existido um problema de conexão com meu iMac. Quando termino meus trabalhos desligo o imac e depois quando retorno pra trabalhar novamente e ligo, ele não se conecta a Airport Time Capsule, impossibilitando retirar os arquivos e fazer o back-up pelo Time Machine, só funciona quando desligo e ligo a Airport Time Capsule, mas acho que isso pode acabar com o aparelho. O que pode esta acontecendo e como resolver? Obrigado.

    This is easier to do with pictures perhaps.. since we do not share a common language and machine translation leaves a lot to be desired.
    In the airport utility bring up your Time Capsule.
    Simply post the screenshots here.
    So here is mine.
    Click on the Edit button and give us the Internet and Wireless and Network tab..
    eg.
    Please also make sure you are set to ipv6 in your wireless or ethernet .. whichever is used.. and do tell which.
    This is wifi in your computer.
    The following are important..
    DO not use long names with spaces and non-alphanumeric names.
    Use short names, no spaces and pure alphanumeric.
    eg TC name. TCgen5
    Wireless name TCwifi
    Use WPA2 Personal security with 10-20 character pure alphanumeric password.
    read apple instructions to help with TM and TC.. they did finally admit it has issues in Mavericks.
    OS X Mavericks: Time Machine problems
    Mount the TC manually in finder.
    AFP://TCgen5.local
    When asked for the password .. that is the disk access password and save it in the keychain.
    Reset Time Machine
    See A4 here. http://pondini.org/TM/Troubleshooting.html

  • Canon MF4270 Scanning Function only works once

    After my upgrading to 8.1 my canon MF4270 scanning function will only work one time when it is installed. Any subsequent boot (cold or warm) and it fails to work.  The software (canon toolbox or windows scan) will just hang indefinitely.  Sometimes
    I get an error msg, sometimes I do not.
    1. Have the latest driver from the Canon website
    2.  Tried reinstalling the driver several times
    3.  Tried the Windows scan utility
    4.  Tried different USB ports.
    5.  When I do get an error msg it is usually a "USB device is not recognized"
    6.  In Device Manager>Universal Serial Bus controllers>Unknown USB Device (Device Descriptor Request Failed
    7.  When I call up the properties for the yellow triangled usb device, event tab in the scrollable window:
    Device USB\VID_0000&PID_0002\5&e658374&0&9 was configured.
    Driver Name: usb.inf
    Class Guid: {36FC9E60-C465-11CF-8056-444553540000}
    Driver Date: 06/21/2006
    Driver Version: 6.3.9600.16442
    Driver Provider: Microsoft
    Driver Section: BADDEVICE.Dev.NT
    Driver Rank: 0xFF0000
    Matching Device Id: USB\DEVICE_DESCRIPTOR_FAILURE
    Outranked Drivers: usb.inf:USB\DEVICE_DESCRIPTOR_FAILURE:00FF2000
    Device Updated: false
    8.  Also received a "
    Windows has stopped this device because it has reported problems. (Code 43)
    A request for the USB device descriptor failed."
    9.  Canon tech support stated it was an MS WIA service issue and not there problem.
    10.  Also tried compatibility routine.
    We run a paperless office so this is pretty huge.  Need your expertise. 
    Thank You!
    * * * UPDATE:  The above discussion was with the MFC4270 fully powered or in energy savings mode and PC fully powered.  Any reboot of the PC would result in no scanner.  Tried turning off the MFC, reboot the PC, then turn on the scanner,  and
    the scanner worked just fine.  A subsequent reboot with MFC remaining on would fail the scanner.  Any reboot with MFC off, then turned on after booting would work.
    So something amiss with driver and/or USB.

    Hi,
    Code 43 means that a device driver notified the operating system that the device failed, this circumstance can occur if the device hardware fails or if the device driver fails.
    To resolve this problem, take the following steps:
    1. To open Device Manager, click Start, click Search programs and files, and then type Device Manager. A list of available matching items appears above the search box; click Device Manager.
    2. Locate the malfunctioning device in the list of devices, right-click the device, and then click Uninstall. When a warning message appears that you are uninstalling a device from your system, click OK. Device manager uninstalls the device.
    3. Right-click your computer name in Device Manager and click Scan for hardware changes. Device manager scans your system and automatically reinstalls your device.
    4. Right-click the device and click Properties. On the General tab of the device Properties dialog box, in Device status, you should see the message This device is working properly.
    For more troubleshooting steps you can find it here:
    http://technet.microsoft.com/en-us/library/cc725873(v=ws.10).aspx
    Regards
    Wade Liu
    TechNet Community Support

  • Quick Find only works once in a Firefox session

    Suddenly, "Quick Find" only works the first time I type in a Firefox session. From the second time onward, the Quick Find bar no more appears. I tried clicking on the "/" key, but no good.
    I have tried un-check and then check again the "Seacrh for text when I start typing" option. But no good, either.
    How can I get it fixed?

    Have you seen
    * [[searching within a page#w_quick-find]]_quick-find
    Try using the single colon ' instead of the slash /
    I also note you may still be on Firefox 9, so it may be worth updating to the current firefox 11. <br/>There is also an old article
    * [[quick find bar opens when typing in text fields]]
    Try Firefox in [[safe mode]]
    * no need to make changes in the first window just click on continue.
    * if problms continue then whilst in safe mode also ensure you are only using the defult theme, and disable all plugins.

  • HTTP GET only works once

    Web UI Builder:
    I have a device that responds to HTTP GET messages.
    I made a simple vi that uses the HTTP GET String function connected to a string constant and WireShark to monitor Ethernet traffic.
    When the vi is first run an HTTP message is sent and replied to.
    If the vi is run again the message is not transmitted.
    If the HTTP GET message is changed the new message will be transmitted. But not twice.
    If LabVIEW Web UI Builder is closed and restarted the message will again be sent just once when run.
    Why is the message only being sent once? It's like all outgoing messages are being tracked and only sent once.

    I think this is standard (but not always desirable) behavior of the networking stack that Web UI Builder uses. (On Windows, it's basically the built in/  Internet Explorer networking stack). After the first GET request with the same URL, if the server doesn't send no-cache headers, a cached result will be returned.
    If you control the server that you're connecting to (and can add HTTP headers), try adding a no-cache header to the GET response. ("Cache-Control: no-cache" is the first one I'd try).
    If you don't control the server you're connecting to / that doesn't work, another workaround is to append a query string parameter with a random number or timestamp. With this approach, the GET URL is always changing, so the caching behavior is disabled and the request should always go to the server.
    (Something like this appended to the end of the URL:
    or, "&n=[timeInTicks]" if you're already using other query parameters)

  • Spry Accordion only works once and doesn't redraw after content update

    Hello,
    I am constructing an Accordion via inner.HTML.  I finally got this to work, HOWEVER, it will only execute correctly once.  When I call "doSpryData" the first time all is well.  When it gets called the second time, the "alerts" fire but the Accordion does not redraw itself and no data is displayed (function doSpryData below).
    I would appreciate any ideas on what I'm doing wrong!!!!
    Thanks and cheers!
    function doSpryData(){
              alert("in spry data!");
              var thisWhat = document.getElementById("searchByWhat").value;
        var currentid = document.getElementById("thisid").value;
              var myStr = "";
              var Acc1 = "";
              Mailings.url = "GetXML1.asp?what="+thisWhat+"&thisid="+currentid;
              Mailings.loadData();
              Mailings1.url = "GetXML2.asp?what="+thisWhat+"&thisid="+currentid;
              Mailings1.loadData();
              if ((thisWhat =="1") || (thisWhat =="2")){
              myStr += "<div id='example1Region' spry:region='Mailings1' >";
                        myStr += "<div id='Acc1' class='Accordion' tabindex='0'>";
                                  myStr += "<div id='Panel1'  class='AccordionPanel'>";
                                            myStr += "<div class='AccordionPanelTab'>{CompanyName} - Info</div>";
                                            myStr += "<div class='AccordionPanelContent'>{CO_Address1}<br>{CO_Address2}<br>{CO_City} <br>{CO_Country}</div></div>";
                        myStr += "<div  class='AccordionPanel'>";
                                  myStr += "<div class='AccordionPanelTab'>{CompanyName} - Trainees</div>";
                                  myStr += "<div class='AccordionPanelContent'>";
                                  myStr += "<table width='969' id='MyResults1' border='0' cellspacing='2' cellpadding='2' >";
                 myStr += "<tr id='thead' height='25' bgcolor='#FFFFFF' '>";
                 myStr += "<th width='20'   class='contactinfo'>Edit</th>";
                myStr += "<th width='20' class='contactinfo' align='center'>Select</th>";
                 myStr += "<th width='170' class='contactinfo' spry:sort='TraineeLastName'>Trainee</th>";
              myStr += "<th width='160' class='contactinfo' align='center'>Title</th>";
                 myStr += "<th width='160' class='contactinfo'>Phone</th>";
                 myStr += "<th width='250' class='contactinfo'>Email </th>";
                 myStr += "<th width='95' class='contactinfo'>Internal Code </th>"; 
                 myStr += "<th width='30' class='contactinfo'>Active</th></tr>";
              myStr += "<tr><td style='padding-bottom:20px;'></td></tr>";
              myStr += "<table class='scrollTable' border='1' cellspacing='2' cellpadding='2' >"
               myStr += "<tr  spry:repeat='Mailings1' spry:setrow='Mailings1' spry:hover='hover' spry:even='even' spry:odd='odd'>";
                myStr += "<td  width='23' align='center'><input name='SelectedProspect' id='SelectedProspect' type='radio' onclick = 'OpeniFrameURL('EditCandidateForm.asp?pid='+{CKeyNew}, 600,800); return false;'></td>";
                myStr += "<td  width='23' class='detail' align='center'><input type='checkbox' name='SelectedOne' id='SelectedOne' value='{CKeyNew}'/></td>";
                myStr += "<td  width='180'class='detail'>{TraineeLastName},  {TraineeFirstName}</td>";
                 myStr += "<td  width='165'class='detail'>{JobTitle}</td>";
                 myStr += "<td  width='160'align='center'  class='detail'>{TR_CellPhone} / {TraineePhoneNumber}</td>";
                myStr += "<td  width='250'class='detail'>{TraineeEmail}</td>";
                myStr += "<td  width='105' class='detail'>{InternalCode}</td>";
                myStr += "<td  width='30' class='detail'>{TraineeActive}</td>";
                myStr += "</tr>";
                myStr += "</table></table>";
                                  myStr += "</div></div>";
              myStr += "</div></div><scr"+"ipt type='text/javascript'>var Acc1 = new Spry.Widget.Accordion('Acc1');Spry.Data.initRegions('example1Region');</"+"script>";
              alert(myStr);
              var div = document.getElementById("mainContent"); 
       div.innerHTML = myStr;
       var x = div.getElementsByTagName("script");
       for(var i=0;i<x.length;i++) 
           eval(x[i].text);
    var observer = { onPostUpdate: function(notifier, data) { alert("post update!");var Acc1 = new Spry.Widget.Accordion('Acc1'); } };
    Spry.Data.Region.addObserver("example1Region", observer);
    /*Spry.Data.initRegions("example1Region");
    Spry.Data.updateAllRegions();*/

    Hello to all,
    I have spent HOURS trying to figure this out....
    I know the above code is messy, but it does correctly do the accordions via innerHTML.  I have a dropdown on my page and when the user changes the input there, I call "doSpryData" and it is supposed to 1) reload XMLDataSet and 2) redraw the Accordion (I would like to have different data displayed on the same page depending on what user selects).  For some reason, it will not redraw the accordion and show the data after it has been done once. 
    I am really desperate so any ideas would be much appreciated!
    Cheers,

  • Changing a JPanel, remove () - add () - validate () only works once

    I have a JPanel with several JTextFields. When the user clicks a button, I need to replace it with a different JPanel. I only have two of these JPanels so far, but will add more later. Both of my JPanel objects are singletons; they are created the first time they are used and every time after that the object returns the same instance. I am using the following code to swap from one JPanel to another (the variable dialog is the containing JPanel).
    dialog.remove (0);
    dialog.add (otherPanel, 0);
    dialog.validate ();This works fine, but only the first time. If I continue clicking the button to tell it to swap back and forth, the second panel remains displayed. I have a feeling this has something to do with me using singleton JPanels because after they have both displayed once it stops working, but I can't figure out why it would matter that they are singletons. If you remove a component, can you add that same component back again later? Is there something else I could be missing?

    If you can't use a CardLayout, then the general format of your code should be:
    panel.remove(...);
    panel.add(...);
    panel.revalidate();
    panel.repaint();If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)", that demonstrates the incorrect behaviour.
    http://homepage1.nifty.com/algafield/sscce.html
    Don't forget to use the "Code Formatting Tags", so the posted code retains its original formatting.
    http://forum.java.sun.com/help.jspa?sec=formatting
    Better late than never :)
    Edited by: camickr on Feb 24, 2008 12:22 AM

Maybe you are looking for