J_scurity_check fails in Firefox 4 - firefox4

The applications works fine in Firefox3.6 ,all versions of IE. I downloaded Firefox 4 and tried to login. When I entered user name and password and click on submit button, It just clears the labels and when I hit on refresh button it submits the form. If I enter wrong userid and password it redirects to the error page.
<form method="POST" action="j_security_check">
Username: <input type="text" name="j_username"> <br/>
Password: <input type="password" name="j_password">
<input type="submit" value="Login">
</form>
There are no error messages in the logs.

I still have no clue about your problem as you do not give much details about your environment and application. Do you use any javascript or ajax in your login page for example? Do you have some mal formed tags between tags?
In my case, I am using java-ee-5, JSF 2.0 framework (My login page works in Firefox 3.6, Opera 11 and IE8 but not in Google Chrome)
Here is my working login page (tested on Firefox 3.6.17 and 4.0.1).
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:o="http://openfaces.org/">
<h:head>
<div align="center">
<h:outputText value="Logon"
style="text-align: center;font-weight: bolder"/>
<br />
</div>
<h:outputStylesheet name="css/style.css"/>
<link rel="icon" href="#{resource['images/diagnostic.ico']}" type="image/x-icon"/>
<link rel="shortcut icon" href="#{resource['images/diagnostic.ico']}" type="image/x-icon"/>
</h:head>
<h:body style="font-weight: lighter;background: url(#{resource['images/master-bg.jpg']});background-repeat: repeat;">
<h:form id="logonform" onsubmit="document.logonform.action = 'j_security_check';">
<p:panel header="#{bundle.Login}" style="font-weight: lighter">
<h:panelGrid columns="2">
<h:outputLabel for="j_username" value="#{bundle.Username}" style="font-weight: bold;"/>
<input id="usernameid" type="text" name="j_username" />
<h:outputLabel for="j_password" value="#{bundle.Password}" style="font-weight: bold;"/>
<input type="password" name="j_password" />
<h:outputText value="" />
<h:panelGrid columns="2">
<p:commandButton value="Connexion" type="submit" ajax="false"/>
<p:button outcome="Logon" value="Cancel" />
</h:panelGrid>
</h:panelGrid>
</p:panel>
</h:form>
</h:body>
</html>
I used the same plain html form as you and it is working for me too in Firefox 4.0.1 and even better than 3.6.17.

I am also seeking an answer to this problem. I am developing a JavaEE6/JSF2 web application that runs inside Glassfish (first 3.0.1 and now 3.1).
The FORM based login was working fine on Firefox3.x versions, and still works fine on Safari5.0.5, but "fails silently" on both Firefox4.0.1 and on Google Chrome 12.0.742.91. (I am on Mac OS X and have not checked IE.)
It is very difficult to provide diagnostics since there are none.
Q: Are there any other logs or possible source of diagnostics I can switch on for Firefox and/or Google Chrome that might throw light in the subject ?
Here is my form:
<form id="loginForm" method="POST" action="j_security_check">
<h:panelGrid columns="3" styleClass="login" columnClasses="login-label, login-field">
<h:outputLabel for="j_username">Username:</h:outputLabel>
<h:inputText id="j_username" required="true" />
<h:message for="j_username" />
<h:outputLabel for="j_password">Password:</h:outputLabel>
<h:inputSecret id="j_password" required="true" />
<h:message for="j_password" />
<h:outputLabel for="login_button"></h:outputLabel>
<h:commandButton id="login_button" value="Login" />
</h:panelGrid>
This is similar to examples shown elsewhere that are claimed to be compatible with Firefox 4, such as from here (to respect copyright conditions not copied here, please examine external link then return):
enter link description here
That login form is claimed to be compatible with Mozilla Firefox 4, Internet Explorer 8, Chrome 11. Safari 5, Opera 11. But I can't see that it is very different from my own.

Related

JQueryMobile 1.4.2 + Android 2.2/2.3 forms

I'm working in a phonegap project with JQueryMobile 1.4.2 and I have a problem with old android devices. It works in android modern versions but, forms have issues over 2.2 and 2.3 versions.
On Android 2.2 devices: I can't use inputs because when I click screen (anywhere) button is pressed.
On Android 2.3 devices: When I start to write on input text field, screen starts to scroll up and down.
Any idea?
Head:
<link rel="stylesheet" href="./css/jquery.mobile-1.4.2.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.4.2.js"></script>
Form:
<form id="form_login" method="post" name="form_login" onsubmit="login();">
<div id="modulo_login">
<div data-i18n="acces.subtit" id="tit_mlu"></div><input id="nif_nie"
name="nif_nie" tabindex="1" type="text" /> <input id="pwd" name="pwd"
tabindex="2" type="password" />
<div id="pwd_mlu">
<a data-i18n="acces_particular.olv" data-transition="slide" href=
"rec_contr.html"></a>
</div>
</div><input class="btn" data-i18n="[value]acces.entrar" tabindex="3" type=
"submit" />
</form>
I had the issue you explained with android 2.3 devices and solved it removing from all css files the following property: -webkit-backface-visibility.

Primefaces BlockUI doesn't work

I have a Problem with Primefaces BlockUI. After i click on the p:commandButton the form is updated and it shows the correct things, but the blockUI doesn't hide the form.
I found out there are several Problems with blockUI and p:commandButtons which uses update.
<h:form id="form">
<h:panelGroup id="askInput">
<p:inputTextarea id="sparql" value="#{connect.query}" rows="10"
cols="80" rendered="#{resultController.askStatus}"
styleClass="width size" />
<p:watermark for="sparql" value="Ask your Questions here..."
rendered="#{resultController.askStatus}" />
<h:panelGroup rendered="#{!resultController.askStatus}">
<p:dataTable var="result" value="#{resultController.maps}"
scrollRows="20" scrollable="true" scrollHeight="500"
id="results">
<p:columns value="#{resultController.header}" var="column">
<f:facet name="header"> #{column}</f:facet>
<h:outputText value="#{result[column]}" styleClass="size" />
</p:columns>
</p:dataTable>
</h:panelGroup>
<p:commandButton value="Search More NOW" id="searcher"
actionListener="#{resultController.setRs(connect.result())}"
update="form" styleClass="btn btn-primary width" />
<p:blockUI widgetVar="dlg" block="form" trigger="searcher">
LOADING<br />
<p:graphicImage value="./images/ajax-loader.gif" />
</p:blockUI>
</h:panelGroup>
</h:form>
Now i found something interesting in the deployed xhtml page:
<script id="form:j_idt31_s" type="text/javascript">
$(function()
{PrimeFaces.cw('BlockUI','dlg',
{id:'form:j_idt31',block:'form',triggers:'form:searcher'});});
</script>
And
<button id="form:searcher" name="form:searcher"
class="ui-button ui-widget ui-state-default ui-corner-all
ui-button-text-only btn btn-primary width"
onclick="PrimeFaces.ab({source:'form:searcher',update:'form'});return false;"
type="submit">
<span class="ui-button-text ui-c">Search More NOW</span>
</button>
If i copy the function of the script in the javascript console of my browser execute it.
After that exectue the onclick function of the button in the console. everything works.
So my guess is that the script isn't load and therefore it can't be invoked. So any idea how i can invoke it by myself?
If you need anything else i will put it here ;)
THANKS ALOT IN ADVANCE :)
i found a solution (still not working for me, but for a co-worker of mine)
$(document).ajaxStart(function() {
PF('dlg').show();
});
$(document).ajaxComplete(function(){
PF('dlg').hide();
binding();
});
This shows on EVERY ajax start the BlockUI and hide it after the completion.
Like i said unfortunately doesn't work for me but for my co-worker, so hopefully it helps other people :)
FINALLY FOUND THE ANSWER :)
I had a jquery.js file under my resources. Primefaces provides a jquery.js itself.
After i deleted the jquery.js everything works :)

Enable/disable panel on click of button in jsf/primefaces?

I have a Button called Add oncilck of add panel needs to be displayed and within the panel there is a cancel button onclick of cancel the panel should be closed my problem is onclicking the add button the panel is coming for a moment and disapperaring. actually i have incuded template_2.xhtml which has .. if i remove from template_2.xhtml the panel is working fine but these warnings are coming like this The form component needs to have a UIForm in its ancestry. Suggestion: enclose the necessary components within i want both of things to work fine and warnings should not come .Here is my codei know the problem that i am using 2 times form in 1 xhtml page but not able to overcome that help me out
`
<h:commandButton value="Add" id="show" action="#" onclick="panelwv.show()" ></h:commandButton>
<h:form>
<p:panel id="panel" widgetVar="panelwv" visible="false" header="Add Dependents">
<h:panelGrid id="myPanel" columns="3" cellpadding="5" styleClass="text-input">
<h:outputText value=""/>
<h:outputLabel value="Name" style="font-family: cursive;font-size: 18px;font-weight:normal;"/>
<h:inputText id="name" value="#{depco.depapp.dep.name}" styleClass="border" label="First Name" />
<h:outputText value=""/>
<h:outputLabel value="Relationship" style="font-family: cursive;font-size: 18px;font-weight:normal;"/>
<h:inputText id="rel" value="#{depco.depapp.dep.relationship}" styleClass="border" label="Relationship" />
<h:outputText value=""/>
<h:outputLabel value="Date of Birth" style="font-family: cursive;font-size: 18px;font-weight:normal;"/>
<p:calendar id="dob" value="#{depco.depapp.dep.dob}" showOn="button" label="Date of Birth" />
<h:outputText value=""/>
<h:outputLabel value="Emp Id" />
<h:selectOneMenu value="#{depco.depapp.dep.empId}" >
<f:selectItems value="#{coemp.empapp.itemsAvailableSelectOne}" var="emp" itemLabel="#{emp.empId}" itemValue="#{emp.empId}" />
<f:converter converterId="employeeConverter" />
</h:selectOneMenu>
<h:outputText value=""/>
<h:commandButton value="Save" action="#{depco.createDepAction()}"/>
<h:commandButton action="#" id="hide" onclick="panelwv.hide()" value="cancel"/>
</h:panelGrid>
</p:panel>
</h:form>
`
Your Example is working fine for me, [using Primefaces 3.5 JSF 2.1.13].
It might be the problem with the buttons you used.
Usually h:commandButton will not do a Ajax submit, it submits the form untill you specify f:ajax explicitly, so that might be the reason the panel is coming and disappearing.
Use p:commandButton which does a ajax submit by default.or else use f:ajax with the h:commandButton.
Since you are not calling any ManagedBean's property or method from your h:commandButtons, you can even use h:button.
JSF menu and submenu tags should be included within form tag .so i just mage a separate jsf file with some name(say xyz.xhtml) and i just included the xyz.xhtml in actual jsf page using

oncomplete=“PF('dlg').hide();” causes “PF cannot be found” error [duplicate]

This question already has an answer here:
ReferenceError: PF is not defined
1 answer
On the PrimeFaces website, they have many examples of how to use their components. One feature that I find very useful is the ability to show and hide PrimeFaces dialogs. In the examples this is accomplished like this:
<p:dialog header="Enter FirstName" widgetVar="dlg" resizable="false">
<h:form id="form">
<h:panelGrid columns="2" style="margin-bottom:10px">
<h:outputLabel for="firstname" value="Firstname:" />
<p:inputText id="firstname" value="#{pprBean.firstname}" />
</h:panelGrid>
<p:commandButton id="submitButton" value="Submit" update=":display" oncomplete="PF('dlg').hide();"/>
</h:form>
</p:dialog>
<p:outputPanel id="display" style="display:block;margin-top:10px;">
<h:outputText id="name" value="Hello #{pprBean.firstname}" rendered="#{not empty pprBean.firstname}"/>
</p:outputPanel>
If you notice in the command button, it calls:
oncomplete="PF('dlg').hide();"
However, when I try to reproduce this example, my Firebug debugger complains that PF cannot be found. Is there something that I need to add to my JSF page to have access to PF?
You can replace
oncomplete="PF('dlg').hide();"
by
oncomplete="dlg.hide();"
If you use Primefaces 3.5 or older:
<p:commandButton id="submitButton" value="Submit" update=":display" oncomplete="dlg.hide();"/>
For Primefaces 4.0 :
<p:commandButton id="submitButton" value="Submit" update=":display" oncomplete="PF('dlg').hide();"/>

Is it possible to cancel Ajax-Requests with a custom dialog with Primefaces 3.3?

We want to display a confirmation dialog if a user changes values in a selectOneMenu. This works quite good with the browsers native confirm() method because it blocks until the user decides. Is there an elegant (preferable client-side) solution to do this with primefaces dialogs so the look is consistent over different browsers?
Current solution:
<p:selectOneMenu id="som" value="#{foo.item}">
<f:selectItems value="#{foo.items}" var="i" itemLabel="#{i.name}" itemValue="#{i.value}" />
<p:ajax event="change" onstart="return confirmChange()" />
</p:selectOneMenu>
<script type="text/javascript">
function confirmChange() {
return confirm("O'RLY?");
}
</script>
You could use PrimeFaces' <p:confirmDialog> or even just <p:dialog>.
<p:selectOneMenu id="som" value="#{foo.item}" onchange="confirm.show()">
<f:selectItems value="#{foo.items}" var="i" itemLabel="#{i.name}" itemValue="#{i.value}" />
</p:selectOneMenu>
<p:confirmDialog widgetVar="confirm" message="ORLY?" header="Confirm" severity="alert">
<p:commandButton value="Yes" action="#{bean.submit}" process="som" oncomplete="confirm.hide()" />
<p:commandButton value="No" type="button" onclick="confirm.hide()" />
</p:confirmDialog>
Perform the confirmation job in #{bean.submit}. You could if necessary abstract this all away with a tag file or a composite component so that it's nicer reuseable.
<p:selectOneMenu id="som" value="#{foo.item}" onchange="confirm.show()">
<f:selectItems value="#{foo.items}" var="i" itemLabel="#{i.name}" itemValue="#{i.value}" />
</p:selectOneMenu>
<my:confirmDialog id="confirm" message="ORLY?" action="#{bean.submit}" process="som" />
Note that there's no means of "cancelling" ajax requests here. You just don't invoke it until really confirmed.

Resources