Alert view displaying wrong title - iphone

Hi i'm using phone gap for developing an application.when i'm displaying an alert i'm doing alert("download complete") in html page. but it is displaying title as index.html. can any one please help me from this situation.

I believe you can use the notification. Please call it after deviceready.
Please refer here: http://docs.phonegap.com/en/2.2.0/cordova_notification_notification.md.html
Add this on config.xml
<feature name="Notification">
<param name="ios-package" value="CDVNotification"/>
</feature>
Then, instead of calling alert(); use the code below.
navigator.notification.alert(
"This is a message.", // message
alertDismissed, // callback
'Error!', // title
'OK' // buttonName
);
function alertDismissed() {
// do something
}

Related

How can i handle popups in playwright-java?

How can i handle alerts and popups in playwright-java?
there are different methods in API like page.onDialog(), page.onPopup(), what is the difference between them and how can i generate a handle?
//code to launch my browser and url
Playwright playwright = Playwright.create();
Browser browser = playwright.chromium().launch(new LaunchOptions().withHeadless(false).withSlowMo(50));
BrowserContext context = browser.newContext();
Page page = context.newPage();
page.navigate("http://myurl.com");
//had to switch to iframe to click on upload button
Frame mypage = page.frameByName("uploadScreenPage");
//below line is triggering the alert
mypage.setInputFiles("//*[#id='fileUpload']",Path.of("C:\\myFile.jar"));
//using this code to handle alert, which is not working
page.onDialog(dialog -> {dialog.accept();});
unable to accept alert using the above code. also alert has occurred after clicking an element that is inside an iframe. how can i handle such alerts?
Dialogs are messages like an alert or a confirm, whereas popups are new pages, like the one you would get by calling window.open.
This is how you can use it :
page.onDialog(dialog -> {
assertEquals("alert", dialog.type());
assertEquals("", dialog.defaultValue());
assertEquals("yo", dialog.message());
dialog.accept();
});
page.evaluate("alert('yo')");
I am happy to answer this question. I encountered the same situation and find the solution. Please see below:
//Handling Pop-up or new page
Page pgdriver1 = pagedriver.waitForPopup(new Runnable()
{
public void run() {
pagedriver.click("text=\"Analiza\"");
}
});
pgdriver1.click("//button[normalize-space(#aria-label)=\"Close dialog\"]/nx-icon");
I hope this answer your question.
//listening to the alert
page.onDialog(dialog -> {dialog.accept();});
//next line will be action that triggers your alert
page.click("//['clickonsomethingthatopensalert']")

redirect to list page after clicking on add button in JSF and html page [duplicate]

I have three XHTML pages;
index.xhtml
page_1.xhtml
page_2.xhtml
In the index.xhtml page, I have a commandButton which sends the user to page_1.xhtml. All this is done in the navigation rule in faces-config.xml.
How would I redirect the user to page_2.xhtml from the index.xhtml using another commandButton assuming that both commandButtons' actions are linked to a backing Java class?
Just bind the buttons to different action methods which each return a different outcome.
<h:commandButton value="Go to page 1" action="#{bean.goToPage1}" />
<h:commandButton value="Go to page 2" action="#{bean.goToPage2}" />
with
public String goToPage1() {
// ...
return "page_1";
}
public String goToPage2() {
// ...
return "page_2";
}
Navigation cases are not necessary. JSF 2.0 supports implicit navigation. The navigation outcome can just be the path/filename of the desired target view. The file extension in the outcome is optional.
If you don't necessarily need to perform any business action on navigation, or you can do it in the (post)constructor of the backing bean of the target page instead, then you can also just put the outcome value in the action directly.
<h:commandButton value="Go to page 1" action="page_1" />
<h:commandButton value="Go to page 2" action="page_2" />
A <h:commandButton> will however not perform a redirect, but a forward. The enduser won't see the URL being changed in the browser address bar. The target page isn't bookmarkable. If you can, I'd suggest to use <h:button> instead.
<h:button value="Go to page 1" outcome="page_1" />
<h:button value="Go to page 2" outcome="page_2" />
Or if you really need to invoke a business action, but would like to perform a real redirect, then append faces-redirect=true as query string to the outcome value.
public String goToPage1() {
// ...
return "page_1?faces-redirect=true";
}
public String goToPage2() {
// ...
return "page_2?faces-redirect=true";
}
See also:
How to navigate in JSF? How to make URL reflect current page (and not previous one)
When should I use h:outputLink instead of h:commandLink?
You can also do this, in any part of your code to be redirected to "example.xhtml"
ExternalContext ec = FacesContext.getCurrentInstance()
.getExternalContext();
try {
ec.redirect(ec.getRequestContextPath()
+ "/faces/jsf/example.xhtml");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Add two navigation cases as shown below. In the action methods, return outcomes corresponding to the buttons.
<navigation-rule>
<from-view-id>index.html</from-view-id>
<navigation-case>
<from-outcome>page1</from-outcome>
<to-view-id>page_1.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>page2</from-outcome>
<to-view-id>page_2.xhtml</to-view-id>
</navigation-case>
</navigation-rule>

Ionic 3 modal display message

I have already designed the Ionic 3 modals. Now I would like to display some message ( Hello Modal ). How do I display the message inside the modal?
Below is my openModal code.
openModal() {
const myModal = this.modal.create('ModalPage');
myModal.present();
}
I would like to display the message using translate. In my case, the message will be set in en.json file, and from there I need to call the message in the HTML file. This is where I am stuck.
In ionic 1,I have something like ,
$translate(['USER_DATA']).then(function(translations) {
vm.userData=translations.USER_DATA;
}
And I will be calling vm.userData in my HTML which will display the message in modal. how do I achieve the same translate code in ionic 3
Its that simple.
import {TranslateService} from '#ngx-translate/core';
...
constructor(private translate : TranslateService)
...
this.translate.setDefaultLang('en');
This is just an overview. Please go-through this link to get a better idea.
They have clearly explained where to place en.json file and how to use it.
Happy Coding.
this.translate.get('here your message u want to translate').subscribe(res => {
const myModal = this.modal.create('ModalPage',res);
myModal.present();
})
In modalpage get the translated message by 'params.data()' and display as u want

valueHelpRequest method not get fired in sap.m.input by enabling showValueHelp="true"

I want to show password by clicking help indicator in control sap.m.input.
As per code valueHelpRequest method must fired but not fired when clicking help indicator.
Its working fine for me. Share some code.
jsbin sample
js view code
createContent: function(oController) {
// button text is bound to Model, "press" action is bound to Controller's event handler
return new sap.m.Input({text:'{/actionName}',press:oController.doSomething,showSuggestion:true,showValueHelp:true,valueHelpRequest:oController.onVHR});
}
I got solution :
var oInput = this.getView().byId("idName"); oInput.attachValueHelpRequest(function(){
console.log("You click on value helper.")
});

Autocomplete and browse for a RelationChoice field are not working in a tile

I have a tile with a RelationChoice field, but the field just has the static html form elements (a "nothing" radio button, a text input and a 'Search' button), and it does not respond dynamically. In comparing it with an identical tile on another site that works, I noticed that the field-specific js code from plone.formwidget.contenttree and plone.formwidget.autocomplete is not embedded in the tile source. I put breakpoints in https://github.com/plone/plone.formwidget.autocomplete/blob/master/plone/formwidget/autocomplete/widget.py#L142 and in https://github.com/plone/plone.formwidget.contenttree/blob/master/plone/formwidget/contenttree/widget.py#L253, and they are getting hit when the tile loads, and the proper js is being returned. But I don't know why it doesn't get sent to the client.
Any ideas?
Everything else on the tile works fine, and the standard jquery resources are loaded:
++resource++plone.formwidget.autocomplete/jquery.autocomplete.min.js
++resource++plone.formwidget.autocomplete/formwidget-autocomplete.js
++resource++plone.formwidget.contenttree/contenttree.js
Here is the zcml for my tile:
<plone:tile
name="peps.tiles.calltoaction"
title="PEPS call to action tile"
description="A tile containing a full-size link, enclosing plain text"
add_permission="cmf.ModifyPortalContent"
schema=".tile.ICallToActionData"
class=".tile.CallToActionTile"
template="templates/calltoaction.pt"
permission="zope2.View"
for="*"
/>
And here is the tile schema and class:
class ICallToActionData(IRichTextTileData):
target = RelationChoice(
title=_(u"Link target"),
description=_(u'Choose the item to which this button will link'),
source=UUIDSourceBinder(),
required=False,
)
link_text = Text(
title=_(u"Link button text"),
description=_(u"The text for the link button at the bottom"),
)
class CallToActionTile(RichTextTile):
def target_url(self):
url = None
if self.data['target']:
obj = uuidUtils.uuidToObject(self.data['target'])
if obj is not None:
if obj.portal_type == "Link":
site_url = getToolByName(obj, 'portal_url')()
if not obj.getRemoteUrl().startswith(site_url):
url = obj.getRemoteUrl()
else:
url = obj.absolute_url()
return url
def link_text(self):
return self.text_value('link_text')
Plone 4.2.5
plone.app.tiles 1.0.1
plone.formwidget.contenttree 1.0.6
plone.formwidget.autocomplete 1.2.4
The cause of the problem were these Diazo rules:
<drop css:content="body script" />
<after css:theme-children="html body" css:content="html body script" method="raw" />
If a Diazo theme is active, it's always a good idea to deactivate it when debugging issues.