I'm using JDeveloper 11.1.2.4 with JSF 1.2 and having issues with the selectOneChoice components that are being populated by JSF selectItems. Initially the problem was dealing with the selectOneChoice components in popups where if you clicked on the dropdown itself, it would recieve focus but the list would not populate unless you clicked anywhere on the page, outside of the component. I remedied that by changing from an ADF selectOneChoice to a JSF selectOneMenu and that fixed it.
This issue here, I have a selectOneChoice that's not in a popup but rather on a JSPX page that has a valueChangeListener on it. All it did initially was set a Long variable to the newValue (which is being casted to a Long) and then call the method that fills the list.
I added an if statement with a null check then a nested if-else that checks values to disable/enable buttons. So what happens now is I'll click the dropdown, select a value and everything is populated/triggered correctly. If I go and try to click the dropdown to select something else, nothing happens. It just highlights and I see the same value, until I click away and then try again and it works.
What am I missing? Why do I have to click outside of the component for it to fire?
public void templateValueChangeListener(ValueChangeEvent valueChangeEvent) {
myTemplateId = (Long)valueChangeEvent.getNewValue();
if(myTemplateId != null){
if (myTemplateId == 7){
adminButton.setDisabled(true);
notAdminButton.setDisabled(false);
setIsAdminRole(true);
} else if (myTemplateId != 7){
adminButton.setDisabled(false);
notAdminButton.setDisabled(true);
setIsAdminRole(false);
}
}
fillTemplates();
fillAvailablePositions();
}
protected void fillTemplates()
{
List<ContainerTO> list = bigSession.getTheTemplates();
templateList = new ArrayList<SelectItem>();
for(ContainerTO tem : list)
templateList.add(new SelectItem(tem.getId(), tem.getValue()));
}
and here is the JSPX code
<af:selectOneChoice label="Templates:" value="#{AdminBean.myTemplateId}"
valueChangeListener="#{AdminBean.templateValueChangeListener}"
id="soc1"
autoSubmit="true" binding="#{AdminBean.roleTemplateDropDown}"
partialTriggers="cb11 cb10"
immediate="true">
<f:selectItems value="#{AdminBean.templateList}" id="si1"/>
</af:selectOneChoice>
Thanks
So, I've found my answer. Had nothing to do with the code at all but the IDE and browser. Here, we use JDeveloper 11.1.2.4, JSF 1.2 ( -_- ) with an understood requirement to support IE. Long story short, I have to make sure the app works with IE8 because of the components used are broken in anything other than an IE 8 compatible browser. After researching everything, I had the fantastic idea to try it out in Chrome...and it worked. So thus, I re-routed my investigation.
I forced the meta to recognize the IE browser as IE7 then I suppressed the Compatibility warning in web.xml to get the annoyance away. So far so good. THIS IS JUST A WORKAROUND FOR NOW. We will be moving to JDeveloper 12c and JSF 2 as soon as possible.
To force the IE7 mode:
<context-param>
<param-name>User-Agent</param-name>
<param-value>Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1;</param-value>
</context-param>
To suppress the Browser Compatibility Alerts:
<context-param>
<param-name>oracle.adf.view.rich.HIDE_UNSUPPORTED_BROWSER_ALERTS</param-name>
<param-value>IECompatibilityModes</param-value>
</context-param>
Can you try the same code from fillTemplates() to getTemplateList().
Try to fill the select items inside the getter method of f:selectItems.
Thanks.
Related
i am trying to Automate flipkart website in which i am trying to change address but "add new adress" is not getting clicked i have attached the snapshot
my code is like driver.findElement(By.xpath("//*[#id='ng-app']/div/div[2]/ul/li[2]/div/div[2]/div[2]/div[2]/a/span")).click();
please give the appropriate help
I doesn't look that you are clicking active element, the xpath is //*[#id='ng-app']/div/div[2]/ul/li[2]/div/div[2]/div[2]/div[2]/a/span not correct it clicks on some span.
Use Firepath https://addons.mozilla.org/en-US/firefox/addon/firepath/ to get the xpath.
To ensure that button is clickable Use isDisplayed() and isEnabled() method before clicking on "Add New Address" button, this method return boolean value.
driver.findElement(By.xpath("//*[#id='ng-app']/div/div[2]/ul/li[2]/div/div[2]/div[2]/div[2]/a/span")).isDisplayed();
driver.findElement(By.xpath("//*[#id='ng-app']/div/div[2]/ul/li[2]/div/div[2]/div[2]/div[2]/a/span")).isEnabled();
Also you can verify that element is exist on page or not using below code
if(driver.findElements(byVal).size()!=0){
// Element is present.
}
hope it may helpful to identify cause of issue, why its not clickable.
First and foremost, Use a customized Xpath instead of the one you are using which is extracted directly from the browser. If no customized Xpath can be constructed then try a customized Css or any other locator if possible.
Try to go through the following attempts in order (I hope you can grasp why this is):
1- If .click() still doesn’t work, then keep on changing the values of the attributes you are using to construct your customized xpath, cssSelector, or locator.
2- Use the Actions class.
3- Use JavaScript executioner
4- instead of click(), try using any of: .sendKeys(“\n”). Or .sendKeys(keys.ENTER) or .sendKeys(keys.RETURN)
Hello am developing a web application using Oracle ADF and jdev12c. I have a page like below.
The above page is created using a template. That contains three parts. First part is image, second part is deck with more than one panel group layout (Here deck child value is decided using a value from managed bean of scope session.)and third part is actual content facet in this I have dropped a task-flow(bouded) as a region contain .jsff pages.
My problem is every thing is working fine. af:showPrintableBehavior is not working. When I click on the Printable view button am getting the following exception. After the following exception nothing is working in my application. (If I click on any commndLink it is opening in another tab and repeatedly trying to generate the page content for example the table but not displaying the content)
exception
java.lang.IllegalArgumentException
org.apache.myfaces.trinidad.model.RowKeySetTreeImpl.setCollectionModel(RowKeySetTreeImpl.java:315)
org.apache.myfaces.trinidad.component.UIXListView$RowKeyFacesBeanWrapper.getProperty(UIXListView.java:300)
org.apache.myfaces.trinidad.component.FacesBeanWrapper.getProperty(FacesBeanWrapper.java:61)
oracle.adf.view.rich.component.rich.data.RichListView$ListViewBeanWrapper.getProperty(RichListView.java:178)
org.apache.myfaces.trinidad.component.UIXComponentBase.getProperty(UIXComponentBase.java:1912)
org.apache.myfaces.trinidad.component.UIXListView.getSelectedRowKeys(UIXListView.java:451)
org.apache.myfaces.trinidad.component.UIXListView.postCreateCollectionModel(UIXListView.java:157)
org.apache.myfaces.trinidad.component.UIXCollection.getCollectionModel(UIXCollection.java:1671)
org.apache.myfaces.trinidad.component.UIXCollection.getCollectionModel(UIXCollection.java:1255)
org.apache.myfaces.trinidad.component.UIXCollection.getRowKey(UIXCollection.java:493)
oracle.adf.view.rich.component.rich.data.RichListView.visitChildren(RichListView.java:103)
org.apache.myfaces.trinidad.component.UIXComponent.visitChildren(UIXComponent.java:774)
org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:631)
org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:405)
org.apache.myfaces.trinidad.component.UIXComponent.visitAllChildren(UIXComponent.java:504)
org.apache.myfaces.trinidad.component.UIXComponent.visitChildren(UIXComponent.java:482)
org.apache.myfaces.trinidad.component.UIXComponent.visitChildren(UIXComponent.java:774)
org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:631)
org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:405)
org.apache.myfaces.trinidad.component.UIXComponent.visitAllChildren(UIXComponent.java:504)
This is not working in only this page. I have tested this in one empty page that is created without using this template. In that empty page I have created this table and tried with af:showPrintableBehavior and here this behaviour is working fine.
Please help me. How to remove the above exception. Export to excel is working fine.
Thanks in advance.
Try using a clientListener inside the button that prints the page, then stop the event from propagating further:
<af:resource type="javascript">
/**
* Shows a popup from an "action" type event.
* #param {AdfActionEvent} actionEvent the event being handled
*/
function stopEventFromPropagating(actionEvent)
{
actionEvent.cancel();
}
</af:resource>
<af:commandButton text="Click Me">
<af:clientListener type="action" method="stopEventFromPropagating"/>
</af:commandButton>
I have the following code:
<form class="form"
data-ng-submit="modalSubmit(modal.data)"
id="modal-body"
name="modalForm"
novalidate>
This works and when I click on a button of type submit then the modalSubmit function is called.
However I would like to do this in my controller:
$scope.modalForm.$setPristine();
But it gives an error saying:
has no method '$setPristine'
How I can I set the form to pristine? I did try adding data-ng-form="modalForm" but then I get
a message saying something to the effect of duplicate directive names.
I tried changing the form element to a DIV but then the clicking on the submit button does not call
the function
Here's an example (modified from another user) that shows what I am trying to do which is set values to pristine:
plnkr.co/edit/LNanJdAggMLIgxii0cfv?p=preview
You're not doing anything wrong there, only problem is you're referencing an old version of angular in which $setPristine() was not a feature. $setPristine() was added in 1.1.+, so reference a newer version of angular and you're good to go. See it working in this plunk, using 1.2.+.
If you can't upgrade, then a dirty workaround would be to loop through all inputs in the form and set their $dirty and $pristine values manually:
$scope.mp = function() {
$scope.mainForm.$pristine=true;//clean main form
$scope.mainForm.$dirty=false;
angular.forEach($scope.mainForm,function(input){//clean all input controls
if (input !== undefined && input.$dirty !== undefined) {
input.$dirty=false;
input.$pristine=true;
}
});
}
First, your version of angular was old, 1.2.12 is the latest stable on the CDN. But even it wouldn't allow $setPristine because of the HTML5 validation that was going on.
The biggest problem was you used required on the fields instead of ng-required. The browser was doing the form validation for you instead of angular. You could also add the novalidate attribute to the form tag.
http://plnkr.co/edit/l1mUCceSFMFFZWgGgL6u?p=preview
it has already been implemented in this link you can use it this was as it has been demonstrated in the plnkr link.
As you can see from the above description, $setPristine only changes the state of the form (and thereby resets the css applied to each control in the form).
If you want to clear the values of each control, then you need to do for each in code.
This is an unanswered question in some blogs... `
<< Please Click Here To This Unanswered Question In Other Blogs..>>
will greatfull if can..
am trying to retrive Combobox selected item into a TextBox..here is my code..
using AjaxControlToolKit.dll version - 4.5.7.1002 for ComboBox.
i need to run this code on IE11 for sure.
Please help me in getting solution.
~ Udai
For the difference in html mentioned in reference,you need to access your control using clientId, on of the ways is:-
var TextBoxXXXID = <%=textBoxXXXID .ClientID%>
var control= document.getElementById(TextBoxXXXID);
About the issue this can be because of browser compatibility issue, you would like to add meta tag and add app_brower folder specified in the link .
IN IE 11, use this code to find user input in the textbox in the AjaxComboBox.
It is working in Chrome as well.
ASPX -
<ajaxToolkit:ComboBox ID="cboMetric" runat="server"></ajaxToolkit:ComboBox>
Code behind -
TextBox textBox = cboMetric.FindControl("cboMetric_TextBox") as TextBox;
strMetric = textBox.Text;
How can i save the textfields and checkboxes to the DB without reloading the page?
Just to click on the button and then its in the DB. Nothing more. I don't get it. This means when I have a textfield where I type in a content -> then click the button, the content from the textfield should be in the DB and should do nothing more (not reloading the page, or go to top for example).
I don't get it.
EDIT:
When I have a a <div> tag with the id="testid" in the standard create.gsp:
def create() {
def mytestInstance = new Mytest(params)
}
and the <g:remoteLink> which should save this part looks like:
<g:remoteLink class="button" name="myForm" update="testid"
url="[controller:'mytest', action: 'create']" value="....." />
That does not work because the page is refreshing or something like this and the things are not stored in the DB, plus they are not in the textfields any more.
Use <g:formRemote> or <g:submitToRemote> to do the form submission with an Ajax call.
You should be able to use the formRemote tag to send the data to a controller via Ajax
Edit
As it says on that page;
This tag also requires the use of either the <g:javascript/>(link) or <g:setProvider/>(link) tags. See the AJAX section of the user guide to find out more.
Have you done that?