| | Stumble It! | Add to Mixx! | | diigo it | | Slashdot |

Wednesday, February 11, 2009

A Quick Update

I've spent most of the last couple days working on a little JavaScript web app project that I'll do a good write-up on here in a few days. I still need to refine it and do some tweaking before I publish it. The 'Quick-n-Dirty' version is this:
Quickly and easily create and log configuration scripts for Cisco Metro Ethernet devices.
  1. User inputs device variables & clicks 'submit'.
  2. The app builds the config script based on the user input.
  3. It also sends the variables to a SharePoint list for archival & recovery.
All the big steps are done, but like I said, there is still some bug squishing to do. Until the full post comes out, here are a couple of my lessons learned so far from this project:
  • In SharePoint, it's possible to automatically submit a form using Javascript to populate the input fields based on the query string and the following code to execute the 'Submit' function already built into the form:
     var theInputs = document.getElementsByTagName("INPUT");
    var i = 0;
    var objSubmit = "";
    while (i < theInputs.length)
    {
    if (theInputs[i].id.search("Tbl_") > 0 && theInputs[i].id.search("SaveItem") > 0)
    { objSubmit = theInputs[i]; }
    i+=1;
    }
    function fFoxSubmit() // this function is specifically for submissions made in firefox/netscape browsers
    {
    var fn = objSubmit.getAttribute("onClick");
    eval(fn.substr(fn.search(";") + 1));
    }

    if (navigator.appName == "Netscape")
    { window.addEventListener('load', fFoxSubmit, false); }
    else { window.attachEvent('onload', objSubmit.getAttribute("onClick")); }
  • The "CONCATENATE" function in SharePoint calculated columns can only handle 30 items. It took me 30 minutes of head pounding and syntax verification before I thought to see if there was a technical limitation. To work around this I broke the statement into two seperate CONCATENATE statements and CONCATENATE'd those:
    =CONCATENATE(CONCATENATE("blah",[x],"blargh",[honk],...),CONCATENATE("n",[title],"pWn3d",[u],...))

0 comments: