Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grab list field and display in new window 1

Status
Not open for further replies.

vivasuzi

Programmer
Jun 14, 2002
183
hello.

I want to know if this is possible b/c my boss would really like it. When we open Dispform.aspx of our list, we would like one of the fields (comments) to open up in a new window (pop up)

I know how to make the pop-up, but I don't know how to grab the data from the comments field. Is it possible to use javascript to grab data from this one field? Any ideas or help is appreciated!

Below is my javascript to make the window pop up, but right now it doesn't capture the field. I don't know if this will help but I thought it might!

Code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Rick Johnson (frj11@ev1.net) -->
<!-- Web Site:  [URL unfurl="true"]http://rickjohnson.tripod.com[/URL] -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! [URL unfurl="true"]http://javascript.internet.com[/URL] -->

<!-- Begin
function popupWin() {
text =  "<html>\n<head>\n<title>Pop Window</title>\n<body>\n";
text += "<center>\n<br>";
text += "Comments Text would go here";
text += "</center>\n</body>\n</html>\n";
setTimeout('windowProp(text)', 0); 		// delay 0 seconds before opening
}
function windowProp(text) {
newWindow = window.open('','newWin','width=340,height=250');
newWindow.document.write(text);
setTimeout('closeWin(newWindow)', 200000);	// delay 100 seconds before closing
}
function closeWin(newWindow) {
newWindow.close();				// close small window and depart
}
//  End -->
</script>

[cat2] *Suzanne* [elephant2]
[wavey] [wiggle]
 
Can you be more specific. How do I know what the ID of the fields are?

This is the sharepoint code of those two fields I'm trying to grab from

Code:
&lt;!--webbot bot=&quot;ListField&quot; s-Context=&quot;formdisplay&quot; s-List=&quot;{5E1F280E-5D09-47EC-852F-E1B86079E590}&quot; S-Field=&quot;CommentDate&quot; S-Title=&quot;CommentDate&quot; B-ShowTitle=&quot;FALSE&quot; clientside startspan --&gt;&lt;ows:XML&gt;&lt;Field Name=&quot;CommentDate&quot;/&gt;&lt;/ows:XML&gt;&lt;!--webbot bot=&quot;ListField&quot; endspan i-checksum=&quot;50239&quot; --&gt;-- &lt;/font&gt;&lt;/b&gt;
	&lt;font color=&quot;#FF0000&quot; style=&quot;font-size: 11pt&quot;&gt;
	&lt;b&gt;
	&lt;!--webbot bot=&quot;ListField&quot; s-Context=&quot;formdisplay&quot; s-List=&quot;{5E1F280E-5D09-47EC-852F-E1B86079E590}&quot; S-Field=&quot;Important_x0020_Notes&quot;  S-Title=&quot;Important Notes&quot; B-ShowTitle=&quot;FALSE&quot; clientside startspan --&gt;&lt;ows:XML&gt;&lt;Field Name=&quot;Important_x0020_Notes&quot;/&gt;&lt;/ows:XML&gt;&lt;!--webbot bot=&quot;ListField&quot; endspan i-checksum=&quot;9857&quot; --&gt;&lt;/b&gt;

[cat2] *Suzanne* [elephant2]
[wavey] [wiggle]
 
i am srry, i didnt read your first post carefully enough i expected the value you needed to be in an input box, but its not the case on the dispform.aspx's

I would make a custom webpart that gets the id of the item your displaying (the ID is in the querystring), then lookup the values of the list and let the part generate your script to display the popup to the page.

here's a list with all the fields that are available to the diffrent lists.
 
Actually I figured it out. I just put a <div id="commentdiv"> around the sharepoint lines I wanted to "capture"

Then I used your suggestion to get the comment:

comment = document.getElementById("commentdiv").innerHTML

[cat2] *Suzanne* [elephant2]
[wavey] [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top