• Attachments in form don't show on web

    By Kevin Hansen 1 decade ago

    I really kinda over-explained this in the subject line, didn't I? ;-)



    In short, when I attach a file (onto the form, not the attachment field) the files don't show up in the body of the document on the web. Is that intentional? 'Cause it'd be GREAT to have both the options for an attachments field AND the ability to have them on the form.

    • Code for download control wich shows both

      By Philipp Bauer 1 decade ago

      Hi.



      Try this instead of the core - download Control.

      You also have to write an Method getEndung(), wich returns the type of the file (doc, xls, txt etc)

      Further you have to replace the icon (path) or just remove them.



      Hope I could help.



      CODE:



      <xp:table>

      <xp:repeat id="repeat1"

                                                      rows=&quot;30&quot; var=&quot;rowData&quot; indexVar=&quot;rowIndex&quot;&gt;<br/>
      

      <xp:this.value><![CDATA[#{javascript:try{



      var dwnAttach;

      var dwnContent;



      var dwnAll;



      dwnAttach = document1.getAttachmentList("attach");

      dwnContent = document1.getAttachmentList("content");



      dwnAll = dwnAttach.concat(dwnContent);

      dwnAll.sort();

      }catch(e){

      }

      return dwnAll;}]]></xp:this.value>

                                                      &lt;xp:tr&gt;<br/>
                                                          &lt;xp:td&gt;&lt;/xp:td&gt;<br/>
                                                          &lt;xp:td&gt;&lt;/xp:td&gt;<br/>
                                                      &lt;/xp:tr&gt;<br/>
                                                      &lt;xp:tr&gt;<br/>
                                                          &lt;xp:td<br/>
                                                              style=&quot;height:25.0px;padding-bottom:px;padding-top:px;padding-right:10px&quot;&gt;<br/>
                                                              &lt;xp:text<br/>
                                                                  escape=&quot;true&quot; id=&quot;computedField4&quot;<br/>
      

      value="#{javascript:print_r(rowData);}"

                                                                  rendered=&quot;false&quot;&gt;<br/>
      


                                                              &lt;/xp:text&gt;<br/>
      


                                                              &lt;xp:link<br/>
                                                                  escape=&quot;true&quot; id=&quot;link7&quot;&gt;<br/>
      

      <xp:this.value><![CDATA[#{javascript:try{

      return document1.getDocument().getUniversalID() + "/$FILE/" +rowData.getName()

      }catch (e) {

      }}]]></xp:this.value>

      <xp:this.text><![CDATA[#{javascript:try{

      rowData.getName()

      }catch(e){

      }}]]></xp:this.text>

                                                              &lt;/xp:link&gt;<br/>
      




                                                          &lt;/xp:td&gt;<br/>
                                                          &lt;xp:td&gt;<br/>
      


                                                              &lt;xp:image<br/>
                                                                  id=&quot;image8&quot; style=&quot;width:27px;height:27px&quot;&gt;<br/>
      

      <xp:this.url><![CDATA[#{javascript:try{

      var icon;

      var endung = getEndung(rowData.getName());

      //Method to get the ending of the icon file - have to write by yourself

      if (endung == false){

      return "/file.png";

      }

      return "/"+endung+".png";

      }catch(e){

      <br/>
      

      }}]]></xp:this.url>

                                                              &lt;/xp:image&gt;<br/>
      




                                                               <br/>
                                                              &lt;xp:text<br/>
                                                                  escape=&quot;true&quot; id=&quot;computedField7&quot;&gt;<br/>
      

      <xp:this.value><![CDATA[#{javascript:try{

      rowData.getType()

      }catch(e){

      <br/>
      

      }}]]></xp:this.value>

                                                              &lt;/xp:text&gt;<br/>
                                                          &lt;/xp:td&gt;<br/>
      


                                                      &lt;/xp:tr&gt;<br/>
      


                                                  &lt;/xp:repeat&gt;<br/>
                                              &lt;/xp:table&gt;
      
      • Problem with this code

        By Steve Castledine 1 decade ago

        If you use the attachment field as intended it will display the attachment twice.

    • Intended at this point

      By Steve Castledine 1 decade ago

      Being able to attach files in designated areas is the design for this wiki.