Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: help me please?

  1. #1
    New to the CF scene
    Join Date
    Jul 2006
    Location
    london
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help me please?

    i am having trouble with my script here is the script 1st

    Selection[0].setAttribute("onchange", 'DropDownMenuList("addDocuments2")');

    now the problem is where u see the "dropdown menu" it is a js function so when this element is create and inserted in the form it should be able to call on this fuction , i don't know the problem, may be the qoutes is wrong or i have set the attributes wrong

    some 1 please help me

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Try this, the camelCase. IE needs this for it to work properly.
    Code:
    Selection[0].setAttribute("onChange", "DropDownMenuList('addDocuments2')");
    If that doesn't work then you need to post the rest of your code.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New to the CF scene
    Join Date
    Jul 2006
    Location
    london
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for the help i tried that but it still does not do what i want here is the full code
    function addLine()
    {
    var Documents = new Array(5)
    Documents[0]="Invoice";
    Documents[1]="Bill";
    Documents[2]="Packing List";
    Documents[3]="Policy";
    Documents[4]="Other";

    var Values = document.getElementById('Value1');
    Values.value = (document.getElementById("Value1").value -1)+ 2;

    var TRIdName = "Create"+ Values +"TR";

    var tbody = document.getElementById("table1").getElementsByTagName("tbody")[0];
    var row = document.createElement("TR");
    row.setAttribute("id",TRIdName);

    var Cells = new Array(3)
    var Selection = new Array(3)

    var Options = new Array(3)
    var Inputs = new Array(1)

    for (var a=0; a < Cells.length; a++)
    {
    Cells[a]= document.createElement("TD");
    Selection[a]= document.createElement("select");
    Selection[a].className = 'Text';

    if(a==0)
    {
    Selection[0].setAttribute("id","addDocuments2");
    Selection[0].setAttribute("onchange", 'DropDownMenuList("addDocuments2")');

    for (var b=0; b < Documents.length; b++)
    {
    Options[0]=document.createElement("option");
    theText=document.createTextNode(Documents[b]);

    Options[0].appendChild(theText);
    Selection[0].appendChild(Options[0]);
    }
    }
    else
    {
    for (var b=0; b < 10; b++)
    {
    Options[a]=document.createElement("option");
    theText=document.createTextNode(b);

    Options[a].appendChild(theText);
    Selection[a].appendChild(Options[a]);
    }
    }

    }

    Inputs[0]= document.createElement("input");
    Inputs[0].setAttribute("id","InputaddDocuments2");
    Inputs[0].setAttribute("name","addDocuments2");
    Inputs[0].setAttribute("type","text");



    for (var c=0; c < Cells.length ; c++)
    {
    Cells[c].appendChild(Selection[c]);
    if(c==0)
    {
    Cells[c].appendChild(Inputs[0])
    }
    row.appendChild(Cells[c]);
    }
    tbody.appendChild(row);
    }


    see what it ment to happen is u get a selection and when u chose the selection it would appear in the input field, now it all comes up but when making the selection it does not appear in the input field

    and thank you for replying

    sorry if you get a head ache from this

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Okay you might have to use the DOM1 method.
    Code:
    Selection[0].onchange = function()
    {
    DropDownMenuList('addDocuments2');
    }
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New to the CF scene
    Join Date
    Jul 2006
    Location
    london
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    dude u r the man, it works, it's alive, hey do i click to nominate link, or do you have the award already cause

  • #6
    New to the CF scene
    Join Date
    Jul 2006
    Location
    london
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    just 1 more thing in the same codes how can i create this in the elements

    <xsl:attribute name="value">
    <xsl:value-of select="e/fields/Docs"/>
    </xsl:attribute>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •