Home > Domino Tips > Developer > Domino > Moving attachments on a Web form
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

DOMINO

Moving attachments on a Web form


Joanne Lanese
09.02.2004
Rating: -3.60- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


View member feedback to this tip.

This is a Domino solution for hiding the attachments at the bottom of a Web form, and placing them at a designated spot elsewhere in the form. It uses icons that represent the program used to create/read them in.

Instructions:

  1. Add a hidden field on the top of your form. Fields:

    Name: $V2AttachmentOptions
    Type: Text computed for display
    Value: 0

  2. Place another field in your form that is hidden when read:

    Name: MiscBody (doesn't matter)
    Type: Rich Text, editable
    Web Access Display: Using Java Applet
    Default Value: None

  3. Hide paragraph when document is previewed/opened for reading

  4. You will need the images you wish to use to represent the attachments. Place them in your resources image folder. The ones I am using for this example are:

    Word_Icon.gif
    Excel_icon.gif
    Generic_icon.gif
    Pdf_icon.gif
    Powerpoint_icon.gif
    Text_icon.gif

  5. On your form, where you want the attachments with their icons to appear, place a computed text field.

  6. In that field, place the code you see below.

  7. Substitute the NSF file name with your database's name, and server name, if necessary.

This handles up to five attachments. You will have to add more code if you think they will be adding more attachments to one form.

Code:

temp:=@Implode(@AttachmentNames;";");
at1 := @If(@Attachments >= 1;
@Word(temp;";";1);"");
Att1 := @If(@Attachments >= 1;
@Right(@Word(temp;";";1);3);"");
icon1:=@If(@UpperCase(Att1) = "PDF";"
<IMG 
SRC=/ProjectTracking.NSF/pdf_icon.gif
?OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att1) = "XLS";"
<IMG SRC=/BusiRpt.NSF/excel_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att1) = "DOC";"
<IMG SRC=/ProjectTracking.NSF/Word_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att1) = "PPT";"<IMG 
SRC=/ProjectTracking.NSF/powerpoint_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att1) = 
("TXT" : "HTM" : "HTML");"<IMG 
SRC=/ProjectTracking.NSF/text_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(Att1 != "";"<IMG SRC=/ProjectTracking.
NSF/generic_icon.gif?
OpenImageResource BORDER=0 >" ; ""))))));
Final1 := "<a href=""+ @Text
(@DocumentUniqueID)+"/$file/"+at1+"" 
target="_new">" + icon1 + "   " + at1 +
 "</a> <br>";

at2 := @If(@Attachments >= 2;
@Word(temp;";";2);"");
Att2 := @If(@Attachments >= 2;
@Right(@Word(temp;";";2);3);"");
icon2:=@If(@UpperCase(Att2) = 
"PDF";"<IMG 
SRC=/ProjectTracking.NSF/pdf_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att2) = "XLS";"
<IMG SRC=/ProjectTracking.NSF/excel_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att2) = "DOC";"
<IMG SRC=/ProjectTracking.NSF/Word_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att2) = "PPT";"<IMG 
SRC=/ProjectTracking.NSF/powerpoint_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att2) = ("TXT" : "HTM" 
: "HTML");"<IMG 
SRC=/ProjectTracking.NSF/text_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(Att2 != "";"<IMG SRC=/ProjectTracking.
NSF/generic_icon.gif?
OpenImageResource BORDER=0 >" ; ""))))));
Final2 := "<a href=""+ 
@Text(@DocumentUniqueID)+"/$file/"+at2+"" 
target="_new">" + icon2 + "   " +
 at2 + "</a> <br>";

at3 := @If(@Attachments >= 3;
@Word(temp;";";3);"");
Att3 := @If(@Attachments >= 3;
@Right(@Word(temp;";";3);3);"");
icon3:=@If(@UpperCase(Att3) = 
"PDF";"<IMG 
SRC=/ProjectTracking.NSF/pdf_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att3) = "XLS";"
<IMG SRC=/ProjectTracking.NSF/excel_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att3) = "DOC";"
<IMG SRC=/ProjectTracking.NSF/Word_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att3) = "PPT";"<IMG 
SRC=/ProjectTracking.NSF/powerpoint_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att3) = ("TXT" : "HTM" : 
"HTML");"<IMG 
SRC=/ProjectTracking.NSF/text_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(Att3 != "";"<IMG SRC=/ProjectTracking.NSF/
generic_icon.gif?
OpenImageResource BORDER=0 >" ; ""))))));
Final3 := "<a href=""+ 
@Text(@DocumentUniqueID)+"/$file/"+at3+"" 
target="_new">" + icon3 + "   " + at3 
+ "</a> <br>";

at4 := @If(@Attachments >= 4;
@Word(temp;";";4);"");
Att4 := @If(@Attachments >= 4;
@Right(@Word(temp;";";4);3);"");
icon4:=@If(@UpperCase(Att4) = 
"PDF";"<IMG 
SRC=/ProjectTracking.NSF/pdf_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att4) = "XLS";"
<IMG SRC=/ProjectTracking.NSF/excel_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att4) = "DOC";"
<IMG SRC=/ProjectTracking.NSF/Word_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att4) = "PPT";"<IMG 
SRC=/ProjectTracking.NSF/powerpoint_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att4) = ("TXT" : "HTM" : 
"HTML");"<IMG 
SRC=/ProjectTracking.NSF/text_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(Att4 != "";"<IMG SRC=/ProjectTracking.NSF/
generic_icon.gif?
OpenImageResource BORDER=0 >" ; ""))))));
Final4 := "<a href=""+ @Text
(@DocumentUniqueID)+"/$file/"+at4+"" 
target="_new">" + icon4 + "   " +

at5 + "</a> <br>";
at5 := @If(@Attachments >= 5;
@Word(temp;";";5);"");
Att5 := @If(@Attachments >= 5;
@Right(@Word(temp;";";5);3);"");
icon5:=@If(@UpperCase(Att5) =
 "PDF";"<IMG 
SRC=/ProjectTracking.NSF/pdf_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att5) = "XLS";
"<IMG SRC=/ProjectTracking.NSF/excel_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att5) = "DOC";"
<IMG SRC=/ProjectTracking.NSF/Word_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att5) = "PPT";"<IMG 
SRC=/ProjectTracking.NSF/powerpoint_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att5) = ("TXT" : "HTM" : 
"HTML");"<IMG 
SRC=/ProjectTracking.NSF/text_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(Att5 != "";"<IMG SRC=/ProjectTracking.NSF/
generic_icon.gif?
OpenImageResource BORDER=0 >" ; ""))))));
Final5 := "<a href=""+ @Text
(@DocumentUniqueID)+"/$file/"+at5+"" 
target="_new">" + icon5 + "   " + 
at5 + "</a> <br>";

final := final1+ final2+ final3+ final4+ final5; final

MEMBER FEEDBACK TO THIS TIP

The above code can be significantly simplified to:

imgOpen := "<img src="";
imgLoc := "/projecttracking.nsf/";
imgClose := ".gif" border="0">";
thisUnid := @text(@documentuniqueid);
anchorOpen := "<a href="";
anchorMiddle := "" target="_new">";
anchorClose := "</a>";
anchorOpen + thisUnid + "/$file/" + 
@attachmentnames + anchorMiddle + imgOpen + 
imgLoc + @lowercase(@right(@attachmentnames;"."))
 + imgClose + anchorclose;

This will work without having to repeat the code regardless of the number of attachments. The only requirement is for an icon to be associated with each extension in the resource library (or wherever you want for that matter, just change the imgLoc variable).

—Ben J.

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Joanne K. Lanese Jarvis. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Domino
Mimic Lotus Notes Domino application functionality on the Web
A single form to view and edit any Lotus Notes document
DECS and DCR external data access considerations
How to create non-scrolling Lotus Domino view headers on the Web
Disabling the 'Submit' button on a form
An easier way to update a rich text field
Results from Default Notes Search have # of responses in brackets
Lotus Notes/Domino veteran offers comprehensive list of app dev tools
Notes to XML. . .and back again
Creating thumbnail images using LS2J in LotusScript

Lotus Notes Domino Formula Language
View hidden fields on Lotus Notes/Domino forms
Case-insensitive @Unique version combines fields on Lotus Notes forms
Do I use Formula or LotusScript to include a doclink to a Notes view?
Top 10 Lotus Notes/Domino coding and development tips of 2008
Provide rich-text formatting via the Profile document and Formula
Top 10 Formula language tips
Using Formula language code to sort Lotus Notes messages by subject
How to create dynamic JavaScript in Notes Domino without formulas
Stop response documents from showing in a Lotus Notes form
Formula language button manages Deny Access list searches

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts