[jboss-user] [JBoss Seam] - s:link without the href? Only for the onclick
EricJava
do-not-reply at jboss.com
Sat Feb 2 19:43:04 EST 2008
Simple question here:
I'm setting up my entire site in such a way that it will display pages, and the various sections of the page will have an "edit" button next to them. When the user clicks "edit", there is a DHTML operation that transforms the static display into a form. The user can then do things on the form, and click "save", and the data are updated as an AJAX request and the form returns to its static view, and the "edit" button is back. This seems like a very friendly way to display a lot of information on a page, and have it editable in a simple way.
At this stage, I have it working like this:
<div id="staticView">
| .....
| </div>
|
| <div id="formView">
| .....
| </div>
|
| <s:link value="Switch them!" onclick="showAndHide('staticView', 'formView');false;"/>
|
And a corresponding JavaScript function:
function showAndHide($showId, $hideId) {
|
| var $showElement = document.getElementById($showId);
| var $hideElement = document.getElementById($hideId);
|
| $showElement.style.display = 'inline';
| $hideElement.style.display = 'none';
|
| return false;
|
| }
I put all this together, and it works. Then I enclose it in an <h:form>, and it starts doing a whole-page reload on clicking. I tried s:link, h:commandButton, s:button, and it's all the same behavior.
Any suggestions on this?
I'm also thinking of using rich:componentControl, which seems like it is intended for doing things like this, but I can't figure out how to use it. Or are there some other RichFaces components I should try out?
Any pointers would be welcome!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4125807#4125807
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4125807
More information about the jboss-user
mailing list