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 11 of 11
  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Get the ID in an <OBJECT> tag

    Looking to pull the ID from the <OBJECT> tag in this piece of code.
    Once I have the object ID , I would want to put the value into a variable and then push that variable into the "Description" field. This is a date Object btw.

    Any help is appreciated.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
    </head>
    <body>
    <form id="form1">
     <TBODY id=HTML_REGION_EXT_FLD_500084 INFRA_EXT="500084" SDADDED="Y" INFRA_EXT_TYPE="O">
    <TR INFRA_USER_POSITIONED="1">
    <TD vAlign=top INFRA_EXT="500084" INFRA_EXT_TYPE="T">Term Date</TD>
    <TD INFRA_EXT="500084">
    <OBJECT class=Fields style="WIDTH: 230px" tabIndex=1 classid=clsid:{49914DE6-599E-46F2-9A74-37DB33FCF412} name=DP_EXT_FLD_500084 INFRA_EXT_TYPE="F" INFRA_EXT="500084" id="termdate"><param name=HiddenName value="EXT_FLD_500084"><param name=DisplayKind value="2"><param name=AllowBlank value="false"><param name=DefaultToNow value="-1"></OBJECT></TD></TR></TBODY>
    <TBODY id=HTML_REGION_EXT_FLD_500073 SDADDED="Y" INFRA_EXT="500073" INFRA_EXT_TYPE="O">
    <INPUT class=Buttons-Page-Strong accessKey=S onclick=data_copy() tabIndex=1 type=button value="Copy Text">
    <TEXTAREA class=FieldsTextArea style="WIDTH: 550px; HEIGHT: 78px" tabIndex=1 name=REQUEST_DESC rows=1 id="Description"></TEXTAREA></form>
    </body>
    </html>
    <script type="text/javascript">
    function data_copy()
    {
        jet = 
        indexed = 
        option = 
        get_details =
          option + ('.\n');
        document.getElementById("Description").value = get_details;
    }
    </script>

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by abduraooft View Post

    I modified the script to using getAttribute but I receive 'undefined'

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
    </head>
    <body>
    <form id="form1">
     <TBODY id=HTML_REGION_EXT_FLD_500084 INFRA_EXT="500084" SDADDED="Y" INFRA_EXT_TYPE="O">
    <TR INFRA_USER_POSITIONED="1">
    <TD vAlign=top INFRA_EXT="500084" INFRA_EXT_TYPE="T">Term Date</TD>
    <TD INFRA_EXT="500084">
    <OBJECT class=Fields style="WIDTH: 230px" tabIndex=1 classid=clsid:{49914DE6-599E-46F2-9A74-37DB33FCF412} name=DP_EXT_FLD_500084 INFRA_EXT_TYPE="F" INFRA_EXT="500084" id="termdate"><param name=HiddenName value="EXT_FLD_500084"><param name=DisplayKind value="2"><param name=AllowBlank value="false"><param name=DefaultToNow value="-1"></OBJECT></TD></TR></TBODY>
    <TBODY id=HTML_REGION_EXT_FLD_500073 SDADDED="Y" INFRA_EXT="500073" INFRA_EXT_TYPE="O">
    <INPUT class=Buttons-Page-Strong accessKey=S onclick=data_copy() tabIndex=1 type=button value="Copy Text">
    <TEXTAREA class=FieldsTextArea style="WIDTH: 550px; HEIGHT: 78px" tabIndex=1 name=REQUEST_DESC rows=1 id="Description"></TEXTAREA></form>
    </body>
    </html>
    <script type="text/javascript">
    function data_copy()
    {
        jet = document.getElementById("termdate").getAttribute("id");
        jet2 = document.getElementById(jet).text;
        get_details =
          jet2 + ('.\n');
        document.getElementById("Description").value = get_details;
    }
    </script>

  • #4
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    Well, in your case jet2 is undefined, because .text doesn't seem to be working on the object you're trying to call the function to. Jet on the other hand does contain the id in question, i.e. 'termdate' A simple alert after both would show you that the problem doesn't come from the getAttribute function.
    The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

    How to ask smart questions?

  • #5
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Eldarrion View Post
    Well, in your case jet2 is undefined, because .text doesn't seem to be working on the object you're trying to call the function to. Jet on the other hand does contain the id in question, i.e. 'termdate' A simple alert after both would show you that the problem doesn't come from the getAttribute function.
    I understand the getAttribute function is working, but I don't understand why I get Undefined if I use .value or .text for jet2... The date comes in as a text field but im not sure how to access that data.

  • #6
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    So you have....

    Code:
    <input type='text' id='termdate' value='whatever' />
    in your HTML? If that's the case .value should return the contents of the text field. If not... then perhaps you are asking JS to do the wrong thing... i.e. get information from a different location, as in a div or an anchor or whatever?
    The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

    How to ask smart questions?

  • #7
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Eldarrion View Post
    So you have....

    Code:
    <input type='text' id='termdate' value='whatever' />
    in your HTML? If that's the case .value should return the contents of the text field. If not... then perhaps you are asking JS to do the wrong thing... i.e. get information from a different location, as in a div or an anchor or whatever?
    This is the code im trying to pull the data from.

    Code:
    <OBJECT class=Fields style="WIDTH: 230px" tabIndex=1 classid=clsid:{49914DE6-599E-46F2-9A74-37DB33FCF412} name=DP_EXT_FLD_500084 INFRA_EXT_TYPE="F" INFRA_EXT="500084" id="termdate"><param name=HiddenName value="EXT_FLD_500084"><param name=DisplayKind value="2"><param name=AllowBlank value="false"><param name=DefaultToNow value="-1"></OBJECT></TD></TR></TBODY>

  • #8
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    Not an expert in regards to IE-specific HTML... for one, <object> elements don't seem to work all that great in FF, but all in all... from the looks of it, you have some pretty obvious errors in your mark-up... like attributes not being enclosed in quotes and such. Either way... I took the liberty to get a different object to test exactly what different functions return and as far as I saw... value does seem to work. Here is the object I used to test:

    Code:
    <object classid="clsid:F08DF954-8592-11D1-B16A-00C0F0283628" id="Slider1" width="100" height="50">
    	<param name="BorderStyle" value="1" />
    	<param name="MousePointer" value="0" />
    	<param name="Enabled" value="1" />
    	<param name="Min" value="0" />
    	<param name="Max" value="10" />
    </object>
    All in all, the JS returns the value of the current slider position, so the problem you're experiencing isn't coming from the JS, but from the object coding. I'd definitely suggest you look into that, because as stated... I most certainly can't help you there... and once again, I doubt the object will behave the same way in different browsers.
    The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

    How to ask smart questions?

  • #9
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Eldarrion View Post

    All in all, the JS returns the value of the current slider position, so the problem you're experiencing isn't coming from the JS, but from the object coding. I'd definitely suggest you look into that, because as stated... I most certainly can't help you there... and once again, I doubt the object will behave the same way in different browsers.
    Appreciate the help Eldarrion, could you give me the code you used to get the value of the slider ?

  • #10
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    This is what I used:

    Code:
    <script type="text/javascript">
    	function idu() {
    		var jet = document.getElementById('Slider1').getAttribute('id');
    		var jet2 = document.getElementById(jet).value;
    		alert(jet2);
    	}
    </script>
    with the following mark-up:

    Code:
    <input type="button" value="Get value" onclick="idu()" />
    <object classid="clsid:F08DF954-8592-11D1-B16A-00C0F0283628" id="Slider1" width="100" height="50">
    	<param name="BorderStyle" value="1" />
    	<param name="MousePointer" value="0" />
    	<param name="Enabled" value="1" />
    	<param name="Min" value="0" />
    	<param name="Max" value="10" />
    </object>
    Not sure what you want to go for there really, but... hope this helps.
    The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

    How to ask smart questions?

  • Users who have thanked Eldarrion for this post:

    abesmith (03-31-2009)

  • #11
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Eldarrion View Post
    This is what I used:

    Not sure what you want to go for there really, but... hope this helps.
    Appears you're correct it must be the coding of the datetimepicker that is not letting me see the value. However I can't change the javascript of this company so looks like this one falls into the trash. =)

    Thanks for all your help!


  •  

    Posting Permissions

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