This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



May 21, 2012, 4:09 PM
8 Posts

Newbie problem getting a simple action to work

  • Category: Other
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags: simple action
  • Replies: 4
 Hi All,
 
I'm going through Declan Lynch's excellent Learning XPages series trying to get a handle on XPages development.  I've run across a problem that I just cant seem to fix and could do with a nudge in the right direction.
 
I'm on part 24 which involves linking a menu generated from view data to the documents contained within that view (http://www.qtzar.com/blogs/qtzar.nsf/blog.xsp?entry=DSLH-7PRL92)
 
The menu uses a repeat control within a table and the example says to locate the xp:tr tag within the repeat control and assign an onClick event to that element.  The onClick uses a simple action to open the relevant xpage and gets the document id using NotesXspViewEntry.getUniversalID();
 
I've tried this over and over but no matter what I do, I can't seem to get any sort of link working on the table row.  I've tried enabling the event on the first column in the table instead.  I've tried adding a new column with a button and putting the event on the button but I can't seem to get my xpage to render the event at all.  I even tried skipping that example and moving onto part 25 which changes it from a simple action to SSJS but that doesn't seem to do anything either.  It's not that I'm getting an error, it's just that nothing seems to be happening.  If I view Declan's finished application, the links work there so I don't think it's my browser. It's almost like there's a setting somewhere in my application or on my server saying 'don't render any onclick events'.
 
I'm entirely willing to believe that I've missed something really stupid but I cannot figure out what I'm doing wrong!  If anyone can give me any ideas, I'd be very grateful!  
 
I can paste the source of my custom control here if it will help but assume too much of it will be stripped out to be of any use.
 
Thanks for any help! 
Emily 
May 21, 2012, 7:49 PM
586 Posts
Re: Newbie problem getting a simple action to work
 If you have his finished application I would compare the XML source between the two pages.  I'm sure there's some fancy Eclipse way to do that, but worse case open 2 notepads and put them side by side... then do it manually. But that should give you the answer really.  They should be identical...
 
If you can you could try to post the code here.  Not sure how that works.  But doesn't hurt to try.
 
Keep in mind, that when Declan wrote that tutorial, we were in 8.5.0 and he was also learning as he went.  I think it's safe to say that we might do somethings differently.  Not saying that's your problem, just something to keep in mind. 
 
Compare the two pages and see if you can find the difference.  That's your best bet at the moment I think 
 
Dave 
 
 

May 24, 2012, 9:05 AM
8 Posts
Re: Newbie problem getting a simple action to work
 Thank you, David.  
 
Good tip about comparing with the finished app.  Unfortunately they do quite a lot more to it before the end so it's difficult to do a compare with an earlier version of the page.   
 
Also a very valid point about the age of the examples.  At the moment I'm just trying to get my brain to start thinking in xpages rather than classic Notes development so having this sort of ground-up guide is a great jumping off point for the way I learn.  Hopefully this will get me into the correct mindset from which I can get on with figuring out the better ways of doing things that have come along with newer versions of Designer.  
 
Thanks for replying to another of my questions.  And also thanks for all the information you make available on your website.  I always end up making a visit to NotesIn9 when I'm on one of my learning xpages days! 
 
Emily 
 
 
May 22, 2012, 8:51 AM
261 Posts
Re: Newbie problem getting a simple action to work
Hello Emily,
 
I tested the scenario described in the blog post and got it working without any problems in version 8.5.3. Your code should eventually look something like this:
 
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">

    <xp:this.data>
        <xp:dominoView var="view1" viewName="vwUsers"></xp:dominoView>
    </xp:this.data>

    <xp:table>

    <xp:repeat id="repeat1" rows="30" value="#{view1}" var="rowData" disableOutputTag="true">
   
        <xp:tr id="aRow">
            <xp:eventHandler event="onclick" submit="true" refreshMode="complete">
                <xp:this.action>
                    <xp:openPage name="/Person.xsp" target="openDocument" documentId="#{javascript:rowData.getUniversalID()}"></xp:openPage>
                </xp:this.action>
            </xp:eventHandler>
       
            <xp:td>
                <xp:text escape="true" id="computedField1">
                    <xp:this.value><![CDATA[#{javascript:rowData.getColumnValue("userName")}]]></xp:this.value>
                </xp:text>
            </xp:td>
               
        </xp:tr>
   
    </xp:repeat>
   
    </xp:table>

</xp:view>

 
I'd suggest to compare the code above with yours and see what you missed.
 
Good luck!
 
Mark
 
BTW: the "fancy Eclipse way" David is referring too is: select the two design elements you want to compare (hold down CTRL), right click and choose Compare With --> Each other.
May 24, 2012, 9:16 AM
8 Posts
Re: Newbie problem getting a simple action to work
BTW: the "fancy Eclipse way" David is referring too is: select the two design elements you want to compare (hold down CTRL), right click and choose Compare With --> Each other.
 
Excellent tip!  That one will definitely come in useful.  This is the sort of thing we've really been missing out on all these years in the Designer client.  Good to see this sort of thing starting to make an appearance. 
 
Right, I compared the code in your event handler with mine and had exactly the same thing.  No clues there unfortunately.  What I found shortly afterwards, however, was that I've done what I always do which is shoot myself in the foot by fiddling rather than just following the instructions.  Unfortunately, this is how I learn, but it doesn't half cause me headaches sometimes! 
 
What I'd done is set the 'createForm' property on the parent xpage to false.  I'd done this because not having this set had caused me a peculiar css issue in one of the earlier examples (an h2 within a .lotusForm class form has some margin settings which may not have been in the oneui css when Declan wrote his tutorial).  For some reason, preventing Domino from putting a form element in the html also prevents it from applying the onclick events within the control.  I'm going to have a look at the different html which gets generated with the option set and not set and try to understand why, but for the moment my problem is fixed and I am happy! 
 
Thanks for taking the time to reply.  Oh, and so I know for the future, did you paste your code directly into this editor or did you do something special for it to have posted nicely like that?
 
Emily 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal