You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Mike Kienenberger <mk...@gmail.com> on 2005/11/07 22:56:01 UTC
Re: Screen refresh
Stefan,
Did you make any progress on this?
I was looking at it again today, and it seemed to me that I could use
the following code to accomplish this kind of effect. My thinking was
that calling getScrolling() from the onchange of the <select> would
use the coordinates of the <select> element instead of the submitting
button.
Unfortunately, it doesn't seem to work.
=================================================
<h:selectOneMenu
onchange="pulldownChanged()"
value="#{dataModel.itemValue}">
<f:selectItems value="#{page.items}"/>
</h:selectOneMenu>
<script language="javascript">
// <![CDATA[
function pulldownChanged(){
clear_form();
document.forms['form'].elements['autoScroll'].value=getScrolling();
document.getElementById("form:nonclearingRefreshButton").click();
}
// ]]>
</script>
<!-- non-clearing refresh button; JSF will see it as refreshButton -->
<f:verbatim>
<input type="submit" style="display: none;" value="Submit"
name="form:refreshButton" id="form:nonclearingRefreshButton"/>
</f:verbatim>
<!-- never used directly; refreshButton exists so verbatim html
above can imitate it -->
<h:commandButton id="refreshButton"
value="Submit" action="#{page.refresh}"
style="display:none">
</h:commandButton>
On 10/27/05, Mike Kienenberger <mk...@gmail.com> wrote:
> Stefan,
>
> You are correct in that the current implementation only scrolls to a
> link or a button. I was proposing that you take advantage of the
> infrastructure that was there to expand to to scroll to other
> components.
>
> I'm not sure exactly how it would work, but I'd think in the short
> term, it would be something like this.
>
> onclick="setScrollToComponentAndSubmit()"
>
> You may have to manually create a button to submit it. This is a
> similar button I use to trigger special javascript submit code.
>
> <f:verbatim>
> <input type="submit" style="display: none;"
> onclick="document.forms['form'].elements['autoScroll'].value=getScrolling();"
> value="Submit" name="form:refreshButton"
> id="form:nonclearingRefreshButton"/>
> </f:verbatim>
>
> If you're looking to contribute a myfaces component to handle all of
> this automatically, I can only point you in the right direction (the
> autoScroll field and the getScrolling() function). You'll have to
> figure out the details as I don't have the skillset (javascript) to
> help you. :)
> But there's already something in place in MyFaces. It's just a matter
> of converting it to your needs.
>
> On 10/27/05, stefan.maric@bt.com <st...@bt.com> wrote:
> >
> > Mike
> >
> > <context-param>
> > <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
> > <param-value>true</param-value>
> > <description>
> > If true, a javascript function will be rendered that is
> > able to restore the
> > former vertical scroll on every request. Convenient
> > feature if you have pages
> > with long lists and you do not want the browser page to
> > always jump to the top
> > if you trigger a link or button action that stays on the same
> > page.
> > Default: "false"
> > </description>
> >
> >
> > </context-param>
> >
> >
> >
> > Have already got that set in my web.xml
> >
> > Guess it's not operating because I'm NOT using a link or button action – see
> > jsp snippet below
> >
> >
> >
> > Simon
> >
> >
> >
> > Do you envisage it operating something like this
> >
> >
> >
> > <h:selectBooleanCheckbox id="selectBusinessType"
> >
> > value="#{node.selected}" immediate="true"
> >
> > valueChangeListener="#{demo.processValueChange}"
> >
> > onclick="submit()" >
> >
> > <t:focus componentId="id_of_component_to_focus"/>
> >
> > <h:selectBooleanCheckbox >
> >
> >
> >
> > If NOT, then how – as I can see it being required at several places on a
> > form
> >
> >
> >
> >
> >
> > Stefan Maric | IT & Professional Services | BT Global Services
> >
> > E: stefan.maric@bt.com | www.bt.com/globalservices
> >
> >
> >
> > This electronic message contains information from British Telecommunications
> > plc, which may be privileged
> >
> > or confidential. The information is intended for use only by the
> > individual(s) or entity named above. If you
> >
> > are not the intended recipient, be aware that any disclosure, copying,
> > distribution or use of the contents of
> >
> > this information is strictly prohibited. If you have received this
> > electronic message in error, please notify
> >
> > me by telephone or email (to the number or email address above) immediately.
> >
> >
> >
> > Activity and use of the British Telecommunications plc e-mail system is
> > monitored to secure its effective
> >
> > operation and for other lawful business purposes. Communications using this
> > system will also be monitored
> >
> > and may be recorded to secure effective operation and for other lawful
> > business purposes.
> >
> >
> >
> > British Telecommunications plc. Registered office: 81 Newgate Street London
> > EC1A 7AJ Registered in
> >
> > England no: 1800000
> >
> >
>