HTMLB Link

Morning SDN,
Cud U help with this:
Iam trying to close the window when a user clicks a link called 'close'.
<hbj:link id="link5"
text="Close"
reference="javascript:self.close()"
target="_TOP">
The above is notworking..
Any hints?

both the below code should work.
<hbj:link id="link5"
text="Close"
reference="#"
onClientClick="javascript:self.close();"/>
or
<hbj:link id="link5"
text="Close"
reference="#"
onClientClick="javascript:self.close();">
<% link5.setOnClientClick("javascript:self.close();")%>
</hbj:link>

Similar Messages

  • Regarding onClick event of htmlb:Link element.

    Hi All,
    We have a table in which we are displaying error messages.
    The requirment is that each message should be a link which , when clicked should set the focus on respective element in the form.
    I am displaying each message as link as follows:
    <%
      loop at itab_message into wa_message.
                  %>
    count = count + 1.
                  %>
                  </td>
                  <td bgcolor="#F0F0F0">
                  <htmlb:link id            = "link<%= count %>"
                              text          = "<%= wa_message-msg %>"
                              >
                  </htmlb:link>
                  </td>
                  </tr>
                  <%
      endloop.
                  %>
                  </table>
                  <%
      refresh itab_message.
                  %>
                  <%
      endif.
                  %>
    Displayng messages as links is fine , but how can i acchieve the functionality , that on clicking a particular link , the focus should be set on the respective field.
    For Ex:
    There are two error messages:
    1)Enter your name
    2)Select material group from drop down list box.
    If the user clicks 1st message the focus should be set on NAME element.
    Thanks,
    Anubhav.

    Hi,
    this is not gonna be easy but first, you´re not using
    <div class="jive-quote"> </div>
    so you should erase it.
    Second, you have to extend the use of label <htmlb:link> in this way:
    <htmlb:link id        = "link<%= count %>"
                      text          = "<%= wa_message-msg %>"
                      onClientClick = "set_focus('your_field')" >
    And then, some Javascript code:
        function setfocus(myfld) {
                if (document.forms.elements[myfld] != null) {
                    document.forms.elements[myfld].focus();
    Hope it helps.

  • Extended notification by email problems with htmlb:link

    Hi,
    Have problem with link
    using
    <htmlb:link id     ="action"
    reference= "<%= LINK_URL %>" >
    everything is fine till the END
    link is shown OK
    <a class="sapLnk" id="action" href="link" target="blank"> etc.
    but
    when i receive email
    link is with additional "D" char
    can`t get out where it is adding it.
    <a class="sapLnk" id="action" href=D"link"" target=blank"> etc.

    Did some investigation.
    After MHT file goes to SODD table (and all related ones, where page is parsed to HEX)
    In conversion from hex to soli
    all quotes in HTML e.g. " are converted to =3D=22 text =22
    3D is mark of '=' in HEX
    =22 is mark of " in HEX
    and in some part of document display soli table content all these 3D=22 are replaced by related ascii symbol.
    still can`t get why in all code those 3D=22 and =22 are replaced but in href not. Encoder (some where at point of hex-to-soli and vice versa )is adding only D after href in link (<a href="link">text</a>)
    tried to hardcode link without quotes
    e.g.
    <a href=link>text</a>
    encoder added "D" before link and quote after.
    <a href=Dlink">text</a>

  • HTMLB Link : opening in new window

    Hello,
    I have a custom worksetmap component (which extends AbstractPortalComponent).
    In one scenario it renders a list of sap systems, on click of which, opens a saplogonpad.
    Now the issue we are facing is that when user clicks on one such link, worksetmap component screen goes blank.
    We are using following way to set HTMLB link properties: -
    titleLink.setReference(<link to sap system>);
    Is there any way to open this in a new window so that worksetmap component stays on its current state?
    Thanks & Regards,
    Amey

    Hi Amey,
    you can use titleLink.onClick="EPCM.doNavigate(targetUrl....);"
    see this page to understand the navigation API.
    Navigation API - Running an Enterprise Portal - SAP Library
    in your case you should either use navigation mode 1 (new window),
    3 (new headerless window) or 10 (new headerless window standards mode).
    according to your previous statement I think you need navigation mode 1.
    BR,
    Saar

  • HTMLB Link issue

    Hi all,
    We have a trouble using htmlb link object.
    How can I link an image?
    I'm using the following code but no work's:
             <hbj:link
                       id="search"
                       text=""
                       target="_TOP"
                       onClick="search_now" />
                    <hbj:image                
                    src="advanced.gif"
                    alt=""  />                  
             </hbj:link>
    Can anyone help us?
    Thanks in advance,
    David

    Hi Anto,
    it's a bug within HTMLB, see hbj:link without onClientClick ?
    I don't know if someone (e.g. MS) has opened an OSS for this, but it seems that this is not the case, for in EP6 SP2 P27 the bug still exists...
    It's not my trouble, it's yours, so I kindly ask you to help SAP getting rid of this one-thousand-years-old-wearing-white-beard-bug... and open an OSS message.
    Hope it helps &
    have a nice weekend
    Detlev

  • HTMLB Link Control

    Hello All,
    I am using a HTMLB Link Control,
    Here my requirement i am generating the Link ID Dynamically and also it is in loop.How can i call onClientClick and jsObjectNeeded
    <hbj:link
              id="<%=ID+i%>"
              text="link"
              reference=""
              target=""
              tooltip=""
              >
         <% *?*.setOnClientClick("myFunction()");%>
    </hbj:link>
    How can i call the ID for Link?
    Regards,
    Aksiti

    Hi,
       I get your question. Can think of one solution. You can create JSP2 with new portal component. Create a dumy JSP. Now When else statement is called, call dummy JSP with javascript to open JSP2 in new window like this.
    window.open(Project.portalcomponentname,title);
    Let me know if it works.
    Regards,
    Harini S

  • Htmlb link setOnClientClick giving NullPointerException

    I have a htmlb link tag in a JspDynPage that I'm trying to execute some javacript with when the link is clicked.  The problem I'm having is that when I run the component I get a NullPointerException.  Here is the code that is failing...
    <hbj:link id="link1" text="test link" reference="" tooltip = "This is a test link" target="_blank" >
         <%
         link1.setOnClientClick("alert('Click')");
         %>
    </hbj:link>
    The error is
    Caused by: java.lang.NullPointerException
    at com.sapportals.htmlb.event.EventManager.renderJavaScriptFragment(EventManager.java:436)
    at com.sapportals.htmlb.event.LinkClickEvent.renderJSFunction(LinkClickEvent.java:95)
    at com.sapportals.htmlb.unifiedrendering.ie5.LinkRenderer.render(LinkRenderer.java:42)
    at com.sapportals.htmlb.rendering.PageContext.render(PageContext.java:982)
    at com.sapportals.htmlb.taglib.LinkTag.doEndTag(LinkTag.java:95)
    I've also try the .setClientEvent(EventTrigger.ON_CLICK,"....") method with simular results.

    Hey Scott
    As it is a link the keyword should be
    onClientClick  and not setOnClientClick
    I guess  now u wont be getting this error
    Chk this
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sapportals.km.docs/library/ep/sap%20htmlb%20guidelines">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sapportals.km.docs/library/ep/sap%20htmlb%20guidelines</a>
    Swathi

  • Nested controllers and htmlb:link

    Hi,
    I have an bsp application with the following architecture:
    Main controller and some subcontrollers created by <bsp:call> on the main page controlled by the main controller.
    Everything in these subcontrollers and main controller works fine, but when I add next subcontroller by calling it from main page using <htmlb:link> - reference to newController.do the application stops working properly.
    I have an instance of model class, created at the beginning in do_init of main controller and I'd like to have the same instance in all of my subcontrollers.
    I'm calling the model class in subcontrollers like this:
    DATA: lo_main_controller TYPE REF TO app_main_controller.
      lo_main_controller ?= m_parent.
      m_model = lo_main_controller->m_model.
    For subcontrollers created by <bsp:call> it works fine, but subcontrollers created by <htmlb:link> have this instance set to initial after every click on the link.
    It is crucial for me to have links in my application and also to have one instance of model for all my subcontrollers.
    Does anyone knows how to solve my problem, maybe creating links in different way?

    This application is really helpful, but I think that there is no <htmlb:link> example.
    My problem is that subcontrollers called by <htmlb:link> are  missing class instance created in the main controller.
    I was trying to create subcontrollers in do_init of main controller, but when I call them by <htmlb:link>, not by <bsp:call> the connection with the main controller is lost.

  • Wrapping a htmlb link element

    I have a long htmlb link that should be wrapped to fit in a FormLayoutCell.
    The generated html page has the <nobr> element inside to indicate that the link will not be wrapped. Any ideas?

    Hi Dethlev,
    a.) The build time is Tue Nov 25 01:27:30 2003. Do I have  the possibility to choose an other one?
    b.) a snippet of the code:
    I use a dynpage, created from the templatedynpage. The layout in subject is:
         FormLayout fl = this.getForm();
    //The layout row has several coloums, but the relevant
    //is this one:     
         FormLayoutRow headerRow = fl.addRow();
         FormLayoutCell imgCell = headerRow.addCell();
         Link editQuestion = new Link( "edit" ,
                                       "Edit Question" );
         editQuestion.setOnClick("editQuestion");
         editQuestion.setFontSize( LinkFontSize.STANDARD );
         editQuestion.setLinkDesign( LinkDesign.RESULT );
         imgCell.addComponent(editQuestion);
    This link produces the <nobr> tag in the html output. I tried to use the link element outside of a formlayout, but it's the same.
    Thank you, Nick

  • Htmlb link to binary content

    I'd like to have a htmlb link and when processing the onClick action I'd like to output some binary content. I've tryed to write the following on the onClick(Event event) handler:
                IPortalComponentResponse response = (IPortalComponentResponse) this.getResponse();
                response.setContentType(new PortalComponentContentType("application/json"));
                try{
                    response.getWriter().write("[1, 2, 3, 4]");
                    binary = true;
                catch(IOException ex){
                    throw new PageException(ex);
    but without success since i get lots of htmljscss and pre appended to my binary output and more htmljscss after.
    Can someone enlighten me on this subject?

    If you want to create a link to the file in the repository, I suggest you use the ShowBinaryServlet.
    From javadoc...
    public class ShowBinaryServlet
    extends ShowPropertyServlet
    Writes a Binary property of a Node to the response OutputStream. The available paramater options are as follows:
    # 1) Pass the node Id in as a request parameter. Eg. http://server:port/app/ShowBinary?nodeId=/repo/12345.
    # 2) Pass the node path as part of the the request pathInfo. Eg. http://server:port/app/ShowBinary/repo/path/file.ext.
    # 3) Pass the node path in as a request parameter. Eg. http://server:port/app/ShowBinary?nodePath=/repo/path/file.ext

  • Htmlb link error

    Hi all,
    I have a jsp with only one htmlb link, pressing the link triggers a server event. The link works fine, but when i put this iview in the home page, i get a JavaScript error: 'all(...)' is null or not an object.
    working with EP6 SP14.
    Any suggestions ?
    Best regards,
    Keren

    Hi,
    Can you give more details about the application and the error.
    Thanks
    Senthil

  • HTMLB Link usage, question

    I am new to HTMLB, question
       Button myButton = new Button("submitButton");
       myButton.setOnClick("sendName");
       myButton.setText("Go to Yahoo");
       myButton.setTooltip("Click here to go to Yahoo.");
      the implementation of onSendName
      public void onSendName(Event myName) throws PageException {
               String url = "http://www.yahoo.com";
               Link lk = new Link("mylink", "yahoo");
               lk.setReference("http://www.yahoo.com");
               lk.setTarget("_blank");
                      ??????? now what???
                     //How do I get to the link?
                     Please help fill in, appreciate:
       If this is the not the right way, any other way to achieve this?
    thanks much.
    Dave Wang

    Yes, Eric, thanks for the answer. in this case. I can substitute the button with a link. But
    In another scenario, I have a tableview, then every cell clicked will lead to a url generated based on the content of the table cell,
      for example, cell(1,2)="userABC", onCellClick() funciton will generate a Link to: "http://xxx?userid=userABC". When user clicks cell(1,2), it should go to the generated URL.
    It would be great if I can generate the link then direct the browser to the URL at onCellClick().
    How do I handle this case?
    thanks for any suggestions.
    Dave Wang

  • Show clickable link inside htmlb:textArea ?

    Hi have a htmlb:textArea that is sometimes enabled and sometimes disabled in my application. The text inside sometimes contains links (starting with http://..).
    If would be ultra cool if these links are directly clickable, so that you dont have to copy and paste them into your browser. I guess this is impossible, right?

    Hi Daniel,
    I guess you mean htmlb:textEdit? Well this element cannot contain other elements - that's why a htmlb:link is not possible. As a try you can play around with the encoding attribute of htmlb:textEdit but I think this will not work either.
    As workaround you could replace the htmlb:textEdit by htmlb:text containing htmlb:link ?
    Let me know if something works!
    Regards,
    Sebastian

  • Htmlb:tableViewColumn and JavaScript Link

    Hi All,
    I'm developing an HTMLB table the first column of which is supposed to be a hyperlink with custom javascript. In other words, when I click on the hyperlink, it's supposed to launch the custom javascript, thus opening a new browser window. This would be similar to the onClientClick property of regular HTMLB links where you can call a custom JS function.
    Do you know how this can be accomplished within HTMLB table? Here is my code sample:
    <htmlb:tableView id="list"
    table="<%=list%>"
    encode='TRUE'
    headerVisible='FALSE'
    design='STANDARD'
    footerVisible='<%=listinc_footerVisible%>'
    visibleRowCount='<%=listinc_visibleRowCount%>'
    rowCount='<%=listinc_lines%>'
    width='<%=width%>'
    sort          = "SERVER"
    keyColumn     = "ID"
    >
    <htmlb:tableViewColumns>
    <htmlb:tableViewColumn columnName  = "ID"
                           title       = "<%=model->get_textpool_text( 'I28' )%>"
                           encode      = "TRUE"
                           wrapping    = "FALSE"
                           sort        = "TRUE"
                           preSelectedSortDirection = "DESCENDING"
                           type        = 'Link'
                           linkColumnKey   = "tableviewlink"
                           linkClickTarget = "_servicerequest3"
                           >
    </htmlb:tableViewColumn>
    <htmlb:tableViewColumn columnName  = "SHORTTEXT"
                           title       = "<%=model->get_textpool_text( 'I22' )%>"
                           wrapping    = "TRUE"
                           sort        = "TRUE"
                           >
    </htmlb:tableViewColumn>
    <htmlb:tableViewColumn columnName  = "RQDAT00"
                           title       = "<%=model->get_textpool_text( 'I52' )%>"
                           wrapping    = "TRUE"
                           sort        = "TRUE"
                           >
    </htmlb:tableViewColumn>
    </htmlb:tableViewColumns>
    </htmlb:tableView>
    The first column "ID" is from where the custom JS is supposed to be launched.
    Thanks!
    Roman D.

    hi,
    do it like this for your first column.
    <htmlb:tableViewColumns>
    <htmlb:tableViewColumn
    columnName  = "ID"                      
    title       = "<%=model->get_textpool_text( 'I28' )%>"                            type        = 'USER'
    >
    <htmlb:link id            = "ID"
                      onClientClick = "your_JS"
                      text          = "your_link_text" >
          </htmlb:link>
    </htmlb:tableViewColumn>
    remember this will launch same javascript for each row.
    if you want to change dynamically for every row then you have to use tableviewiterator to render every row. and change JS accordingly for each row.
    check out weblog for tableview iterator
    /people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator
    regards.

  • How to open the link in new firefox window for web desktop based application? Or how to open the mail/website/rss link in new firefox window

    I am using the firefox 3.6. My problem is that I am using the web desktop and few web desktop based application directly opens link. If I click on rss link than it opens in same window, so no longer access to web desktop. I want to open any kind of link in new window instead of same window. I have tired to change the value of browser.link.open_newwindow, browser.link.open_newwindow.restriction but doesn't work. Also gone through the https://developer.mozilla.org/en/window.open but not sure where to do this in web desktop based application or firefox where we connect the web desktop?
    Is there any way to open the link every time in new firefox window?

    Hi Joseph,
    the HTMLB link object misses the support for onClientClick through the tag lib, see hbj:link without onClientClick ? and OnClientClick Event for Link HTMLB Component for similiar problems and workarounds.
    With this workaround, you can call for example an AbstractPortalComponent, implement doOnNodeReady (with an empty doContent method) and return the PDF, settings the content type on the http before etc.
    Hope it helps
    Detlev
    PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance!

Maybe you are looking for