Code only works if I add Extra character

Hi, so there's a bit of code I use to keep a running list of pages I need to print (puts it in a textbox), solely depending on if certain boxes are checked... Say I have 3 checkboxs, and each represents a certain page or pages to be printed...  If select each of those checkboxes, pagesToPrint (a textbox) will be populated with 9-11, 15-40, 43 of the PDF (I made up the page numbers).  If I unselect one of those checkboxes, I need the value to be removed from pagesToPrint.  So pagesToPrint should read something like 9-11, 15-40.
The code I'm posting below WORKS, except that I have an issue having the text to remove itself from pagesToPrint when the input is just a single number AND when it's the first item in the box... Example: "43" won't remove from pagesToPrint when I unselect the textbox txt1; but if I changed it to "43 " (added space at the end), "43-44" or "43a" all would work.  So if the box read 43, 9-11, 15-40 (the integer only being first) then the 43 wouldn't remove if the corresponding checkbox were unselected.... If it were populated with 9-11, 15-40, 43 (the range being first) then the 43 would remove if the corresponding checkbox were unselected
Why is that??
// script start - Trying to debug a removal issue on txt1 when integer lacks a space, symbol, or letter
//get the button
var btn = this.getField("txt1");
//app.alert("value = "+btn.value);
// this variable would change for each check box to the pages you want printed.
var pagesToPrint = "43";
//check value of checkbox
if(btn.value=="Yes") {
  var action = "add";
else
  var action = "";
updatepagesToPrint(pagesToPrint, action);
function updatepagesToPrint(pagesToPrint, action) {
  //app.alert(pagesToPrint + " :: " + action);
  // get the text field
  var printField = this.getField("pagesToPrint");
  if(action=="add")
  // check if the field is empty
  if ( printField.value == "" || printField.value == " ")
      printField.value = pagesToPrint;
  else
      // as printField has a value, add the new pages to the end of the value
      printField.value = printField.value + ", " + pagesToPrint;
  else
  printField.value = printField.value.replace(pagesToPrint+", ", "");
  printField.value = printField.value.replace(pagesToPrint, "");
  printField.value = printField.value.replace(/^,|^, |, $|,$/, "");
// script end

http://s000.tinyupload.com/?file_id=07374325820103346475
Try to check and uncheck DI change request FIRST.... It stays, when it should delete... Any other order it works.  It must be "89a" or "89-110" or "89 " to work.
If you check the boxes in any other order, it works perfectly.

Similar Messages

  • FPGA code only works on alternate executions

    Hi,
    I have some code I wrote for FPGA which, by itself, works fine. I tried to use "Open FPGA VI Reference" as part of a previous (non-FPGA based) VI. However, I find that the full code only works on alternate executions. I thought this may be because the FPGA VI is not being reset properly. However, I have used "Close FPGA VI Reference" and chose "Close and Reset" and the problem remains.
    Any help is appreciated,
    Thanks.

    Hi Gary,
    I hope you are doing well today! What version of LabVIEW FPGA are you using? When you say you are doing 'alternate executions', what exactly do you mean? Do you run your host VI, stop it and then run it again? Have you tried just using Close instead of resetting the FPGA VI? Also, what are you using the reference for? What are you invoking? It would, also, be better if you post a screenshot of your VI.
    Adnan Zafar
    Certified LabVIEW Architect
    Coleman Technologies

  • AS3 code not working if i add a scene before the as3 code scene

    Hi,
    I have an Actionscript coded flash file which run perfectly without any error.
    I am not getting why it shows an error after i do insert a scene before or a frame before the current frames;
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at myFile_fla::MainTimeline/frame2()
        at flash.display::Sprite/constructChildren()
        at flash.display::Sprite()
        at flash.display::MovieClip()
        at myFile_fla::images_mc_1()
    I am moving all frames along with actionscript to next frame as i want add preloader to it.
    can anyone specify the reason?
    Thank you.

    Hi,
    I have all code on same frame, all movie clips on same frame and all movie clips instance names are correct. My code is working fine if I do not move all frames to Frame2. but i need to move all these frames to Frame 2 so that i can add preloader.
    After debugging I got that its stopping at following action;
    Object(this).movie01_mc.movie01child_mc.visible = false;
    I tried it making;
    Object(root).movie01_mc.movie01child_mc.visible = false;
    but no use.
    Is it necessary to have all of it in first scenes first frame?
    Thank You

  • Code only works in first frame

    Hello,
    I have several buttons, and when each one is mouse clicked by
    the user, text appears in a dynamic text box. I want to have the
    text appear in a different color for each of the buttons. However,
    it is only working in the first frame, and not in subsequent
    frames. All of the buttons have instance names in every frame (in
    fact, they are named the same in frame 1, frame 2, etc. . .--but
    that doesn't seem to be the problem??) Below is my code. Any
    suggestions? Thanks!

    Found the answer. The code defining the variable:
    var my_color:Color = new Color(textBox);
    must only be on the first frame. The rest of the code must be
    on all the frames.

  • My delphi code only works in DAQ driver 6.6 but not in upper version. Why?

    Hi,
    I'm using delphi 6 to program my application. My code was working fine if I'm using DAQ driver 6.6. Now I want to update my driver, but my code doesn't work. It doesn't work for another version of driver, except 6.6. My program will crash if not using 6.6. I'm not using ActiveX controls to communicate with the card. I'm using dll instead. I wonder is it some functions in 6.6 no longer exist in upper version. My code is in the attachment. Thank you
    Attachments:
    DAQInterface.pas ‏39 KB

    Hello;
    That is probably the case there. One thing you can do to double check if that is actually the problem is to probe each NI-DAQ function and see which one is giving you the error.
    Then, you can open the NI-DAQ on line help and search for the function you used on your code. If you can't find it, that means the new version of the driver doesn't support that function anymore.
    Hope this helps.
    Filipe A.
    Applications Engineer
    National Instruments

  • Why is my code only working sometimes?

    This code is supposed to find the sum of the digits in the number 2^1000. However, it returns a decimal that is way off. And, for some reason, if 2^15 or 2^4 or other smaller exponents are used, the code works perfectly. Why is it taking exception with 1000 as an exponent??
    public double TwoToTheThousand() { //Adds all the digits together of the number 2^1000
    double tens = 10.0;
    double sum = 0.0;
    double num = Math.pow(2, 1000);
    double temp = Math.pow(2, 1000);
    for(double a = 0; a > -1; a++) {
    if(tens/10 > num)
    return sum;
    sum += ((num % tens)/(tens/10.0));
    num -= (temp%tens);
    temp = num;
    tens*=10.0;
    return -1.0;
    }

    Are you sure that Double can hold such a huge number?
    I don't think so...
    Edited by: sadrayan on Oct 7, 2008 7:46 AM

  • Code only works after a page reload in firefox 3

    I'm using Flash CS3, exporting for flash player 9 and having
    troubles with the code below only in Firefox 3 (flash player 9 or
    10)
    In IE 6 & 7, all works OK.
    The code below should show small thumbnails of images. It
    does work on everything I tested except firefox 3. What is weird is
    that if I empty my cache and load the page online, it does not show
    any thumbnails or sometimes only one. However, if i reload the page
    without emptying my cache, it will then work perfectly.
    Here is my code (AS2 and XML)
    quote:
    <?xml version="1.0" encoding="utf-8"?>
    <xmldata>
    <pic thumb="gallery/thumb_001.jpg"
    image="gallery/001.jpg"></pic>
    <pic thumb="gallery/thumb_01.jpg"
    image="gallery/01.jpg"></pic>
    <pic thumb="gallery/thumb_002.jpg"
    image="gallery/002.jpg"></pic>
    <pic thumb="gallery/thumb_003.jpg"
    image="gallery/003.jpg"></pic>
    <pic thumb="gallery/thumb_004.jpg"
    image="gallery/004.jpg"></pic>
    <pic thumb="gallery/thumb_04.jpg"
    image="gallery/04.jpg"></pic>
    <pic thumb="gallery/thumb_005.jpg"
    image="gallery/005.jpg"></pic>
    <pic thumb="gallery/thumb_006.jpg"
    image="gallery/006.jpg"></pic>
    <pic thumb="gallery/thumb_007.jpg"
    image="gallery/007.jpg"></pic>
    <pic thumb="gallery/thumb_08.jpg"
    image="gallery/08.jpg"></pic>
    <pic thumb="gallery/thumb_09.jpg"
    image="gallery/09.jpg"></pic>
    <pic thumb="gallery/thumb_10.jpg"
    image="gallery/10.jpg"></pic>
    <pic thumb="gallery/thumb_11.jpg"
    image="gallery/11.jpg"></pic>
    <pic thumb="gallery/thumb_12.jpg"
    image="gallery/12.jpg"></pic>
    <pic thumb="gallery/thumb_013.jpg"
    image="gallery/013.jpg"></pic>
    <pic thumb="gallery/thumb_15.jpg"
    image="gallery/15.jpg"></pic>
    <pic thumb="gallery/thumb_16.jpg"
    image="gallery/16.jpg"></pic>
    <pic thumb="gallery/thumb_17.jpg"
    image="gallery/17.jpg"></pic>
    <pic thumb="gallery/thumb_18.jpg"
    image="gallery/18.jpg"></pic>
    <pic thumb="gallery/thumb_19.jpg"
    image="gallery/19.jpg"></pic>
    <pic thumb="gallery/thumb_20.jpg"
    image="gallery/20.jpg"></pic>
    </xmldata>
    In the following code, the variable prefix is the base path
    to the client web site ie.
    http://www.somedomain.com/somefolder/

    Try the '''''reset''''' described here: <br />
    http://kb.mozillazine.org/Problems_printing_web_pages#Reset_printer

  • Code only working second time round

    Hi all,
    got a weird one here and hoping someone can help me.
    Scenario is this...got some dynamically created textareas on
    the screen and details of each are stored in a datagrid. The user
    can select one from the datagrid (dg_elements) and then change
    certain params for it, namely xy coords, height, width, alpha
    background colour, border colour and border style. Each param is
    taken from various components on the stage, textinput,
    colorpickers, comboboxes etc
    I've a button called but_apply which has this listener...
    but_apply_lnr=new Object()
    but_apply_lnr.click=function()
    // the instance name of the textarea is stored in
    dg_elements.selectedItem.element_name
    inst = eval(dg_elements.selectedItem.element_name)
    inst._x = Number(elex.text)+40
    inst._y = Number(eley.text)+90
    inst.setSize(Number(elew.text),Number(eleh.text))
    inst.depthChild0._alpha=alpharange.value
    inst.backgroundColor=backcol.selectedItem
    inst.borderColor=bordercol.selectedItem
    inst.borderStyle=borderstyle.selectedItem.label
    but_apply.addEventListener("click",but_apply_lnr)
    So, if I amend the x,y, height width or alpha and click
    but_apply then the textarea updates accordingly...however, if I
    change the borderstyle, bordercolour or background colour then
    these don't change...UNTIL I click it a second time when everything
    works!?
    So for example I could change the alpha and the width and the
    backgroundcolor and first time round the alpha and width will
    change, then second time around the bgcolour will update ?!
    Why!???? I thought an updateAfterEvent() may help, but it
    made no difference.
    Can anyone help please!
    Thanks
    Phil

    The UIObject Class is the base class for all V2 Components.
    It adds functionality but also hides the MovieClip Class by
    defining an API that is not tied to the timeline. As a result there
    are often two properties or methods - one from the MovieClip class
    and one from the UIObject Class that can be used.
    With the second click there apparantly is a reference to the
    normal text field (Text Area Component is a wrapper for the normal
    text field).

  • Hide "more" button in a list view, only works for first item in the list

    I have the following code in a list view that outputs several dozen items in a web app.  The code only works for the first item, how can I make it loop through and execute the test for each item in the list view?  The {tag_hide more button} is a checkmark field that yields a numeric 1" if checked otherwise yields a numeric "0".
    <div id="more-option">
            <p class="right"><a href="{tag_itemurl_nolink}" class="btn btn-small btn-very-subtle">More &rarr;</a></p>
          </div>
          <div class="more-selection" style="display: none;">{tag_hide more button}</div>
          <script>
    if ($(".more-selection").text() == "1") {
        $("#more-option").hide();
    </script>

    What's the URL for the site where you are using this?  Offhand, it looks like it should work with your first example so you are either placing the script before those elements are loaded or you might try wrapping your current javascript inside the:
    $(document).ready(function() {
    --- your existing javascript here
    This make sure the code runs once all the html is loaded on the page.  Without seeing a URL and debugging with the js console in Chrome I can't give you a solid answer.
    But, I do know that you can probably do this with a lot less markup.  Once we figure out what the actual problem is I have a better solution mocked up for you on jsfiddle.
    When looking at my HTML code on jsfiddle, please realize I setup some dummy HTML and removed your tags and added actual values which would be output by your tags.  The main thing I did was remove the whole div.more-selection and instead, added a "data-is-selected" attribute on your div.more-option element.  Then, in my javascript for each div.my-option element on the page, we loop through them, find the value of that data attribute and hide that div if it's less than 1 (or 0).
    Here's the fiddle for you to look at:  http://jsfiddle.net/thetrickster/Mfmdu/
    You'll see in the end result that only two divs show up, both of those divs have data-is-selected="1".
    You can try pasting the javascript code near the closing </body> tag on your page and make sure to wrap my js inside a <script> tag, obviously.  My way is neater on the markup side.  If you can't get it to work it's likely a jquery conflict issue.  My version is using the $(document).ready() method to make sure all the code is loaded before it runs.
    Best,
    Chris

  • I have programmed my Iphone to automatically connect to confcalls (dialing the nbr, pausing, dialing the PIN code). Works fine from the Iphone as such. When I connect my Iphone in Bluetooth to my car, only the phone

    I have programmed my Iphone to automatically connect to confcalls (dialing the nbr, pausing, dialing the PIN code).
    Works fine from the Iphone as such.
    When I connect my Iphone in Bluetooth to the voice-driven system in my car (Mercedes C), only the phone number appears to be transmitted. Entering a conference call number via the Iphone while driving is not a good idea.
    How can I fix this ?

    That *****.  I sell electronics on ebay.  Before listing them, i have to test and clean them. I have worked with microsoft Zune, you could sync via wireless through the network to your host computer. 
    i was hoping Apple would add that feature or the ability to connect to my computer via WiFi or Bluetooth and sync it wirelessly...   It would be sweet to have the bluetooth and wireless opened up so you can do more than just  connect to headphones or a headset... 
    I upgraded to the iPhone 4 this past december, i am on replacement # 2 or my 3rd iPhone 4...  I was hoping for some upgrades in quality.  Also being left handed, it seemed to drop many calls and give me very poor reception.  i added a Griffin Elan Form Graphie case that covers all but the front, top button, bottom speakers and volume control buttons and the call and reception quality has improved.  But I sure would have loved to see some improvements in the quality and function of the phone...
    Thanks for your input, i really appreciate your replies... 

  • URL Request will only work in IE?? Please look at this AS3 code.

    The targets only work and will go to the specified page in my ie browser. Does anyone have a fix for this. Code below.
    // Consumer URLs
    loughErneMC.loughErneURLBtn.addEventListener(MouseEvent.CLICK, goSite1);
    function goSite1(evt:MouseEvent):void {
    navigateToURL(new URLRequest("https://gc.synxis.com/rez.aspx?brand=PV&adult=1&step=1&hotel=27070&shell=PV&chain=10237&te mplate=www.preferredhotelgroup.com&guestEmail=PV&promo=MKTIRL&locale=en-US&avcurrency=USD"));
    dromoMC.dromoUrlBtn.addEventListener(MouseEvent.CLICK, goSite2);
    function goSite2(evt:MouseEvent):void {
    navigateToURL(new URLRequest("https://gc.synxis.com/rez.aspx?brand=PV&adult=1&step=1&hotel=26882&shell=PV&chain=10237&te mplate=www.preferredhotelgroup.com&guestEmail=PV&promo=MKTIRL&locale=en-US&avcurrency=USD"));
    castlemartyrMC.castlemartyrURLBtn.addEventListener(MouseEvent.CLICK, goSite3);
    function goSite3(evt:MouseEvent):void {
    navigateToURL(new URLRequest("https://gc.synxis.com/rez.aspx?brand=PV&adult=1&step=1&hotel=26854&shell=PV&chain=10237&te mplate=www.preferredhotelgroup.com&guestEmail=PV&promo=MKTIRL&locale=en-US&avcurrency=USD"));
    heritageMC.heritageURLBtn.addEventListener(MouseEvent.CLICK, goSite4);
    function goSite4(evt:MouseEvent):void {
    navigateToURL(new URLRequest("https://gc.synxis.com/rez.aspx?brand=PV&adult=1&step=1&hotel=27223&shell=PV&chain=10237&te mplate=www.preferredhotelgroup.com&guestEmail=PV&promo=MKTIRL&locale=en-US&avcurrency=USD"));

    I would think this is a security issue.
    You would need to add the swf file to the trusted file list
    http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04a.ht ml
    When the file is available through a http link, this problem will not be visible. The above setting needs to be done when you are running the htm/swf from a local drive.
    Hope this helps.
    Karthik
    p.s. If this post was helpful, please mark the thread as answered

  • Hi I'm a total novice, as you will see. But Iam trying to use template of an employee schedule but when I try to add extra columns it does not add the preset formula with it, so it works out total hours and total pay?   If any one can help please.

    Hi I'm a total novice, as you will see. But Iam trying to use template of an employee schedule but when I try to add extra columns it does not add the preset formula with it, so it works out total hours and total pay?   If any one can help please before I throw it through the window!

    Grum12 wrote:
    Hi I'm a total novice, as you will see. But Iam trying to use template of an employee schedule but when I try to add extra columns it does not add the preset formula with it, so it works out total hours and total pay?   If any one can help please before I throw it through the window!
    Hi Grum,
    If the formulas aren't filling to the new column, you must have changed something in the template since you first opened it. Numbers is rather fussy about filling row content in columns as they are added. Only rows with the same expression in every Body Column will fill when a column is added. Just as an experiment, start a new Employee Schedule document from the Template Chooser and then add a column by clicking the Add Column handle in the upper right corner of the table. If that works, as it should, then think about what might have changed in your working document to disconnect that feature. Maybe we can figure it out together.
    Jerry

  • Region Monitoring iOS 7 : didEnterRegion method is not calling when app is killed by user or by OS in iOS 7 only. It is working fine when it is in background. and the same code is working fine with iOS 6 for both app in suspended mode and background mode.

    Region Monitoring iOS 7 : didEnterRegion method is not calling when app is killed by user or by OS in iOS 7 only. It is working fine when it is in background. and the same code is working fine with iOS 6 for both app in suspended mode and background mode. What changes I have to made to work great in iOS 7 also.

    I rewrote code for debugging purpose and tried to catch error using GetLastError();  method,
    but it only printed 0. Below is code snippet; I think Create() throw an exception
    and code goes to catch block. 
    LONG ConnectTS(CString strIP, UINT n_Port)
    try{
              ErrorLog(0,0,"ConnectTS is calling Create [is going to call]","");
              if(!Create())
    // Exception Line
    n_Err = GetLastError();
    return NET_INIT;
    catch(...)
                       DWORD errorCode = GetLastError();
                       CString errorMessage
                       errorMessage.Format("%lu",errorCode);
                       ErrorLog (0, 0, "Image
    System", (LPTSTR)(LPCTSTR)errorMessage);
                       return  IS_ERR_WINDOWS;
    Output: -
    ConnectTS is calling Create [is going to call]
    Image System
    0

  • HT1752 I am working on a chart in paged with 7 columns. Problem has occurred with amount of row. I have completed 999 rows and it won't allow me to continue. As I need to do approx 3000+ rows, can anyone explain to me how to add extra rows. Thanks Jane

    I am working on a chart in pages with 7 columns.
    Problem has occurred with amount of rows. I have completed 999 rows and it won't allow me to continue. As I need to do approx 3000+ rows, can anyone explain to me how to add extra rows. Thanks Jane

    Try posting in the Pages forum
    https://discussions.apple.com/community/iwork/pages

  • I have a Adobe Creative Cloud's code, this is alphanumeric, but the registry only works with numeric codes ¿where i can use my code?.

    Hi, i have a problem with my Adobe Creative Cloud's code, this is alphanumeric, but the registry only works with numeric codes ¿where i can use my code? is a year-long Creative Cloud subscription.

    You most likely have a redemption code... especially if you did not buy direct from Adobe
    Redemption Code http://helpx.adobe.com/x-productkb/global/redemption-code-help.html
    -or https://forums.adobe.com/thread/1572504

Maybe you are looking for

  • Firefox almost crashes when saving the first picture.

    Every time I load up firefox or restart it, the first picture I try and save (doesn't matter where, what type or where from) firefox freezes up and if I click anywhere it does the not responding status until the picture is downloaded then it continue

  • IPOD WONT COMMUNICATE WITH ITUNES!!!!

    I just got my ipod nano today I thought it would be the best thing ever. But, when I use iTunes, my ipod doesnt show up and it gives me an alert telling me that it wont communticate and to re-install. I re-installed at least 12 times. Is my iPod brok

  • Panasonic AVCHD HDC-SD5`

    I have this camcorder and I must say its alright for being free. However Panasonic doesn't offer any type of support to convert the .mts files to any type that can be viewed on a mac. I have googled it and all I can find is the Wondershare aka Aimers

  • Where to find out the status of retrieved timecard ?

    After Transfer from OTL to BEE program was run , where can we go and check in the back end tables for the status of the RETRIEVED time card ? Will there be a separate column for this or a flag is set. Please let me know the back end table name ?

  • ASA5520 access-list configuration?

    I have two asa5520s, version 7.2(2). I have use access-list for the firewall as: access-list outside extended permit ip object-group mydomain any access-list outside extended permit icmp object-group mydomain any access-group outside in interface out