• context.getUrlParameter("documentid") does not work for me

    By Pappu Kumar Mr Singh 1 decade ago

    I have checked all discussion in this portal. However still i am looking for help

    var id = context.getUrl(); or var id = context.getUrlParameter("documentid") does not work for me either.

    I have tried var id = facesContext.getExternalContext().getRequest().getParameter("documentid"). Worked for me but only in readmode in mobile or in chrome. When i edit the document i am unable to pull the document id.

    Do we have do make any settings to server or in dabase in order to user above functions. I am doing it on my local machine.

    Any Help please ???

    • possible typo

      By Simon McLoughlin 1 decade ago

      Not sure if its a typo in your post but in XPages that parameter that gets appended is "documentId" with a capital I  not with a small i.

      if it was just a mistake in the post and it is still an issue is the documentId parameter/ value in the URL in the browser?

      There are other means of getting a document such as using the "currentDocument variable".

      eg.

      var doc = currentDocument.getDocument();

      var id = doc.getUniversalID();

    • Does not work in Mobile. It works in IE

      By Pappu Kumar Mr Singh 1 decade ago

      Thanks for your response & this is not typo. I am developing a mobile application using mobile controls. This is how the code looks like. When I view the existing document I can see the image attached to the document however when I switch from read mode to edit mode and image goes of. When i check the imange URL it looks like localhost/customer.nsf/null/$File/image1.jpeg





      <?xml version="1.0" encoding="UTF-8"?>

      <xp:view xmlns:xp="http://www.ibm.com/xsp/core"

      xmlns:xe=&quot;http://www.ibm.com/xsp/coreex&quot;&gt;<br/>
          &lt;xe:singlePageApp id=&quot;singlePageApp1&quot; selectedPageName=&quot;homePage&quot;&gt;    <br/>
          &lt;xe:appPage id=&quot;appPage1&quot; pageName=&quot;homePage&quot;<br/>
              resetContent=&quot;false&quot;&gt;<br/>
              &lt;xe:djxmHeading id=&quot;homePageHeading&quot; label=&quot;Home&quot;&gt;&lt;/xe:djxmHeading&gt;<br/>
              &lt;xe:djxmLineItem id=&quot;djxmLineItem1&quot; label=&quot;All Documents&quot;<br/>
                  moveTo=&quot;#allDocumentsPage&quot;&gt;<br/>
              &lt;/xe:djxmLineItem&gt;<br/>
              &lt;xe:djxmLineItem id=&quot;djxmLineItem2&quot; label=&quot;New Customer&quot;<br/>
                  moveTo=&quot;#newCustomerPage&quot;&gt;<br/>
              &lt;/xe:djxmLineItem&gt;<br/>
              &lt;xe:djxmLineItem id=&quot;djxmLineItem3&quot;<br/>
                  moveTo=&quot;#searchCustomerPage&quot; label=&quot;Search Customer&quot;&gt;<br/>
              &lt;/xe:djxmLineItem&gt;<br/>
          &lt;/xe:appPage&gt;<br/>
          &lt;xe:appPage id=&quot;appPage2&quot; pageName=&quot;allDocumentsPage&quot;<br/>
              resetContent=&quot;true&quot; preload=&quot;true&quot;&gt;<br/>
              &lt;xe:djxmHeading id=&quot;djxmHeading1&quot; label=&quot;All Documents&quot;<br/>
                  back=&quot;Back&quot; moveTo=&quot;#homePage&quot;&gt;<br/>
              &lt;/xe:djxmHeading&gt;<br/>
              &lt;xe:dataView id=&quot;dataView1&quot; rows=&quot;7&quot;<br/>
                  openDocAsReadonly=&quot;true&quot; pageName=&quot;#documentPage&quot;&gt;<br/>
                  &lt;xp:this.facets&gt;<br/>
                      &lt;xp:pager partialRefresh=&quot;true&quot; id=&quot;pager2&quot;<br/>
                          for=&quot;dataView1&quot; xp:key=&quot;pagerBottom&quot;&gt;<br/>
                          &lt;xp:pagerControl id=&quot;pagerControl1&quot;<br/>
                              type=&quot;Next&quot;&gt;<br/>
                          &lt;/xp:pagerControl&gt;<br/>
                          &lt;xp:pagerControl id=&quot;pagerControl2&quot;<br/>
                              type=&quot;Previous&quot;&gt;<br/>
                          &lt;/xp:pagerControl&gt;<br/>
                      &lt;/xp:pager&gt;<br/>
                  &lt;/xp:this.facets&gt;<br/>
                  &lt;xe:this.summaryColumn&gt;<br/>
                      &lt;xe:viewSummaryColumn columnName=&quot;Name&quot;<br/>
                          columnTitle=&quot;Name&quot;&gt;<br/>
                      &lt;/xe:viewSummaryColumn&gt;<br/>
                  &lt;/xe:this.summaryColumn&gt;<br/>
                  &lt;xe:this.data&gt;<br/>
                      &lt;xp:dominoView var=&quot;View1&quot;<br/>
                          viewName=&quot;xpAllDocuments&quot;&gt;<br/>
                      &lt;/xp:dominoView&gt;<br/>
                  &lt;/xe:this.data&gt;<br/>
              &lt;/xe:dataView&gt;<br/>
          &lt;/xe:appPage&gt;<br/>
          &lt;xe:appPage id=&quot;documentPage&quot; pageName=&quot;documentPage&quot;<br/>
              resetContent=&quot;true&quot; preload=&quot;true&quot;&gt;<br/>
              &lt;xe:djxmHeading id=&quot;djxmHeading2&quot; label=&quot;Document&quot;<br/>
                  back=&quot;Back&quot; moveTo=&quot;#allDocumentsPage&quot;&gt;<br/>
              &lt;/xe:djxmHeading&gt;<br/>
              &lt;xp:panel&gt;<br/>
                  &lt;xp:this.data&gt;<br/>
                      &lt;xp:dominoDocument formName=&quot;Customer&quot;<br/>
                          var=&quot;document1&quot;&gt;<br/>
                      &lt;/xp:dominoDocument&gt;<br/>
                  &lt;/xp:this.data&gt;<br/>
                  &lt;xe:tabBar id=&quot;documentTabBar&quot;<br/>
                      barType=&quot;segmentedControl&quot;&gt;<br/>
                      &lt;xe:tabBarButton id=&quot;tabBarButtonCancel&quot;<br/>
                          label=&quot;Cancel&quot;&gt;<br/>
                          &lt;xp:eventHandler event=&quot;onclick&quot; submit=&quot;true&quot;<br/>
                              refreshMode=&quot;complete&quot; immediate=&quot;true&quot; save=&quot;false&quot;&gt;<br/>
                              &lt;xp:this.action&gt;<br/>
                                  &lt;xe:moveTo targetPage=&quot;allDocumentsPage&quot;<br/>
                                      transitionType=&quot;slide&quot; direction=&quot;Right to Left&quot;&gt;<br/>
                                  &lt;/xe:moveTo&gt;<br/>
                              &lt;/xp:this.action&gt;<br/>
                          &lt;/xp:eventHandler&gt;<br/>
                      &lt;/xe:tabBarButton&gt;<br/>
                      &lt;xe:tabBarButton id=&quot;tabBarButtonEdit&quot; label=&quot;Edit&quot;<br/>
      

      rendered="#{javascript:!document1.isEditable()}">

                          &lt;xp:eventHandler event=&quot;onclick&quot;<br/>
                              refreshMode=&quot;complete&quot;&gt;<br/>
                              &lt;xp:this.action&gt;<br/>
                                  &lt;xp:changeDocumentMode mode=&quot;edit&quot;<br/>
                                      var=&quot;document1&quot;&gt;<br/>
                                  &lt;/xp:changeDocumentMode&gt;<br/>
                              &lt;/xp:this.action&gt;<br/>
                          &lt;/xp:eventHandler&gt;<br/>
                          &lt;/xe:tabBarButton&gt;<br/>
                      &lt;xe:tabBarButton id=&quot;tabBarButtonSave&quot; label=&quot;Save&quot;<br/>
      

      rendered="#{javascript:document1.isEditable()}">

                          &lt;xp:eventHandler event=&quot;onclick&quot; submit=&quot;true&quot;<br/>
                              refreshMode=&quot;complete&quot;&gt;<br/>
                              &lt;xp:this.action&gt;<br/>
                                  &lt;xe:moveTo forceFullRefresh=&quot;true&quot;<br/>
                                      saveDocument=&quot;true&quot; targetPage=&quot;allDocumentsPage&quot;<br/>
                                      transitionType=&quot;slide&quot; direction=&quot;Left to Right&quot;&gt;<br/>
                                  &lt;/xe:moveTo&gt;<br/>
                              &lt;/xp:this.action&gt;<br/>
                          &lt;/xp:eventHandler&gt;<br/>
                      &lt;/xe:tabBarButton&gt;<br/>
                  &lt;/xe:tabBar&gt;              <br/>
                  &lt;xe:djxmRoundRectList id=&quot;djxmRoundRectList1&quot;&gt;<br/>
                      &lt;xp:br/&gt;<br/>
                      &lt;xp:image id=&quot;image1&quot; height=&quot;100&quot; width=&quot;100&quot;&gt;<br/>
                          &lt;xp:this.value&gt;&lt;![CDATA[#{javascript:&quot;/&quot;+facesContext.getExternalContext().getRequest().getParameter(&quot;documentId&quot;)+&quot;/$File/&quot;+@AttachmentNames()}]]&gt;&lt;/xp:this.value&gt;<br/>
                          &lt;xp:this.url&gt;&lt;![CDATA[#{javascript:&quot;/&quot;+facesContext.getExternalContext().getRequest().getParameter(&quot;documentId&quot;)+&quot;/$File/&quot;+@AttachmentNames()}]]&gt;&lt;/xp:this.url&gt;<br/>
                      &lt;/xp:image&gt;<br/>
                      &lt;xp:br/&gt;<br/>
                      &lt;xp:br/&gt;<br/>
                      &lt;xp:br/&gt;<br/>
                      &lt;xp:label value=&quot;Customer No &quot; id=&quot;label3&quot;&gt;&lt;/xp:label&gt;<br/>
                      &lt;xp:inputText id=&quot;inputText2&quot;<br/>
                          value=&quot;#{document1.txtCustomerNo}&quot; readonly=&quot;true&quot;&gt;<br/>
                      &lt;/xp:inputText&gt;<br/>
                      &lt;xp:br/&gt;<br/>
                      &lt;xp:label value=&quot;Name &quot; id=&quot;NameLabelID&quot;&gt;&lt;/xp:label&gt;<br/>
                      &lt;xp:inputText id=&quot;inputName&quot;<br/>
                          value=&quot;#{document1.txtCustomerName}&quot;&gt;<br/>
                      &lt;/xp:inputText&gt;<br/>
                      &lt;xp:br/&gt;<br/>
                      &lt;xp:label value=&quot;Address &quot; id=&quot;AddressLabelID&quot;&gt;&lt;/xp:label&gt;<br/>
                      &lt;xp:inputText id=&quot;inputAddress&quot;<br/>
                          value=&quot;#{document1.txtAddress}&quot;&gt;<br/>
                      &lt;/xp:inputText&gt;<br/>
                      &lt;xp:br/&gt;<br/>
                      &lt;xp:label value=&quot;Contact No &quot; id=&quot;ContactNoLabel&quot;&gt;&lt;/xp:label&gt;<br/>
                      &lt;xp:inputText id=&quot;inputContactNo&quot;<br/>
                          value=&quot;#{document1.txtContactNo}&quot;&gt;<br/>
                      &lt;/xp:inputText&gt;<br/>
                      &lt;xp:br/&gt;<br/>
      


                  &lt;/xe:djxmRoundRectList&gt;<br/>
              &lt;/xp:panel&gt;<br/>
          &lt;/xe:appPage&gt;<br/>
          &lt;xe:appPage id=&quot;appPage3&quot; pageName=&quot;newCustomerPage&quot;&gt;<br/>
              &lt;xe:djxmHeading id=&quot;newDocumentPageHeading&quot;<br/>
                  label=&quot;New Customer&quot; back=&quot;Cancel&quot; moveTo=&quot;homePage&quot;&gt;<br/>
              &lt;/xe:djxmHeading&gt;<br/>
              &lt;xp:panel&gt;<br/>
                  &lt;xp:this.data&gt;<br/>
                      &lt;xp:dominoDocument var=&quot;document1&quot;<br/>
                          formName=&quot;Customer&quot; computeWithForm=&quot;onsave&quot;&gt;<br/>
                      &lt;/xp:dominoDocument&gt;<br/>
                  &lt;/xp:this.data&gt;<br/>
                  &lt;xe:tabBar id=&quot;newCustomerTabBar&quot;<br/>
                      barType=&quot;segmentedControl&quot;&gt;<br/>
                      &lt;xe:tabBarButton id=&quot;tabBarButtonSubmit&quot;<br/>
                          label=&quot;Submit&quot;&gt;<br/>
                          &lt;xp:eventHandler event=&quot;onclick&quot; submit=&quot;true&quot;<br/>
                              refreshMode=&quot;complete&quot;&gt;<br/>
                              &lt;xp:this.action&gt;<br/>
                                  &lt;xe:moveTo forceFullRefresh=&quot;true&quot;<br/>
                                      saveDocument=&quot;true&quot; targetPage=&quot;allDocumentsPage&quot;<br/>
                                      transitionType=&quot;slide&quot; direction=&quot;Left to Right&quot;&gt;<br/>
                                  &lt;/xe:moveTo&gt;<br/>
                              &lt;/xp:this.action&gt;<br/>
                          &lt;/xp:eventHandler&gt;<br/>
                      &lt;/xe:tabBarButton&gt;<br/>
                  &lt;/xe:tabBar&gt;<br/>
                  &lt;xe:djxmRoundRectList id=&quot;djxmRoundRectList2&quot;&gt;<br/>
                      &lt;xp:label value=&quot;Customer No &quot; id=&quot;label2&quot;&gt;&lt;/xp:label&gt;<br/>
                      &lt;xp:inputText id=&quot;inputCustomerNo&quot;<br/>
                          value=&quot;#{document1.txtCustomerNo}&quot; readonly=&quot;true&quot;<br/>
      

      defaultValue="#{javascript:@UpperCase(@Unique())}">

                      &lt;/xp:inputText&gt;<br/>
                      &lt;xp:br/&gt;<br/>
                      &lt;xp:label value=&quot;Name       &quot; id=&quot;labelName2&quot;&gt;&lt;/xp:label&gt;<br/>
                      &lt;xp:inputText id=&quot;inputTextName2&quot;<br/>
                          value=&quot;#{document1.txtCustomerName}&quot;&gt;<br/>
                      &lt;/xp:inputText&gt;<br/>
                      &lt;xp:br/&gt;<br/>
                      &lt;xp:label value=&quot;Address&quot; id=&quot;labelAddress&quot;&gt;&lt;/xp:label&gt;<br/>
                      &lt;xp:inputText id=&quot;inputTextCategory2&quot;<br/>
                          value=&quot;#{document1.txtAddress}&quot;&gt;<br/>
                      &lt;/xp:inputText&gt;<br/>
                      &lt;xp:br/&gt;<br/>
                      &lt;xp:label value=&quot;Contact No&quot; id=&quot;label1&quot;&gt;&lt;/xp:label&gt;<br/>
                      &lt;xp:inputText id=&quot;inputText1&quot;<br/>
                          value=&quot;#{document1.txtContactNo}&quot;&gt;<br/>
                      &lt;/xp:inputText&gt;<br/>
                      &lt;xp:br/&gt;<br/>
                  &lt;/xe:djxmRoundRectList&gt;<br/>
              &lt;/xp:panel&gt;<br/>
          &lt;/xe:appPage&gt;<br/>
          &lt;xe:appPage id=&quot;appPage4&quot; resetContent=&quot;true&quot; preload=&quot;true&quot;<br/>
              pageName=&quot;searchCustomerPage&quot;&gt;<br/>
              &lt;xe:djxmHeading id=&quot;djxmHeading3&quot; label=&quot;Search Documents&quot;<br/>
                  back=&quot;Back&quot; moveTo=&quot;#homePage&quot;&gt;<br/>
              &lt;/xe:djxmHeading&gt;<br/>
              &lt;xp:panel&gt;<br/>
                  &lt;xp:this.data&gt;<br/>
                      &lt;xp:dominoDocument var=&quot;document1&quot;&gt;<br/>
                      &lt;/xp:dominoDocument&gt;<br/>
                  &lt;/xp:this.data&gt;<br/>
                  &lt;xp:inputText id=&quot;inputSearch&quot; defaultValue=&quot;&quot;&gt;<br/>
                  &lt;/xp:inputText&gt;<br/>
                  &lt;xp:button value=&quot;Search&quot; id=&quot;Search&quot;&gt;<br/>
                      &lt;xp:eventHandler event=&quot;onclick&quot; submit=&quot;true&quot;<br/>
                          refreshMode=&quot;partial&quot; refreshId=&quot;dataView2&quot;&gt;<br/>
                      &lt;/xp:eventHandler&gt;<br/>
                  &lt;/xp:button&gt;<br/>
              &lt;/xp:panel&gt;<br/>
              &lt;xe:dataView id=&quot;dataView2&quot; pageName=&quot;#documentPage&quot;<br/>
                  openDocAsReadonly=&quot;True&quot;&gt;<br/>
                  &lt;xe:this.data&gt;<br/>
                      &lt;xp:dominoView var=&quot;view1&quot;<br/>
                          viewName=&quot;xpSearchCustomer&quot; keysExactMatch=&quot;false&quot;&gt;<br/>
      

      <xp:this.search><![CDATA[#{javascript:getComponent("inputSearch").getValue()}]]></xp:this.search>

                      &lt;/xp:dominoView&gt;<br/>
                  &lt;/xe:this.data&gt;<br/>
                  &lt;xe:this.summaryColumn&gt;<br/>
                      &lt;xe:viewSummaryColumn columnName=&quot;Name&quot;&gt;&lt;/xe:viewSummaryColumn&gt;<br/>
                  &lt;/xe:this.summaryColumn&gt;<br/>
              &lt;/xe:dataView&gt;<br/>
          &lt;/xe:appPage&gt;<br/>
          &lt;/xe:singlePageApp&gt;<br/>
      

      </xp:view>