how to update jquery mobile popup dialog using ajax? - ajax

When a jquery-mobile popup(Dialog) is opened, when clicking a command link inside the dialog, ajax request will update the dialog with the same popup markup with different header and content.
$(PrimeFaces.escapeClientId(id)).replaceWith(content);
id is popupDialog, and content is
<div id="popupDialog"
data-role="popup"
data-overlay-theme="b"
data-theme="b"
data-dismissible="false">
....
</div>
But got error.
Uncaught NotFoundError: Failed to execute 'replaceChild' on 'Node': The node to be replaced is not a child of this node.
It is a normal ajax update DOM element. What might be the cause? Thanks for any insight.

Related

Posting to iframe works in Chrome but not IE or FF

I have a page with a container that gets different content from an ajax request. This content has a form that posts data (and a file) to an iframe that is also in this ajax content container. I can submit the form and it works perfectly in Chrome, but Firefox and IE just sit there like I never clicked the submit button. I have default security settings on each browser, and don't want to change them for this functionality. Can anyone see any bugs in my code or process that would cause this? thanks in advance!
form:
<form action='processUploadFrame.php' method='post' enctype='multipart/form-data' id='myForm' target='iframeUpload'>
<input type='submit' value='Upload' />
iframe:
<iframe name='iframeUpload' frameborder=1 width=750 height=150></iframe>
Solved. My HTML 101 has failed me. Having my submit button in a different table cell than the rest of the form doesn't work in IE and FF, but Chrome is okay with it. Strange. A simple javascript submit link did the trick:
<a href='javascript:document.getElementById(\"myForm\").submit();'>Submit</a>
Here's an article that reminded me about the rules of such: http://www.cs.tut.fi/~jkorpela/forms/tables.html

javascript confirm not working properly with kendo mobile ui

On Ipad or Iphone when I click on cancel in confirmation box ,after cancel touching tab or phone screen again prompts that confirmation box .
Here is my code
<div data-role="view" id="message" data-title="Message" data-layout="default">
<a data-click="closeModalViewLogin" data-role="button" data-align="right">Close</a>
</div>
here is my javascript code
<script>
function closeModalViewLogin()
{
return confirm("Are u sure?")
}
</script>
Please give some suggession
If you are using Phonegap then you can use
notification.confirm(....)
This is a known issue, unfortunately. Launching browser alert and confirm dialogs messes up the events sequence, resulting in the problem you experience. A common workaround we suggest is to wrap the confirm call in a setTimeout.

AJAX call fails depending on position in code, browser fires document.ready mid-call. Twitter Bootstrap issue?

I am chasing a nasty issue. An AJAX call in an onclick handler does not complete, as the browser fires document.ready mid-call. When tracing the readystate and status in the Firebug console I get:
READYSTATECHANGE:1 STATUS:0
READYSTATECHANGE:2 STATUS:0
READYSTATECHANGE:4 STATUS:0
Document Ready (-> this is the
second firing, breaking everything as the UI is rewired )
I believe I am not facing a cross-domain security block as the same AJAX call will complete correctly when called elsewhere in the page.
I am using Jquery 1.8.1 and I have tried multiple variations of AJAX client calls (i.e.
$.getJSON
$.ajax
as well as using the standard XMLHttpRequest object.
Has anyone seen this before? Pointers for deeper debugging would be fantastic.
After having debugged the issues I now have a work around. My AJAX call was invoked from a click handler linked to a Twitter Bootstrap Button. Clicking the button triggered the AJAX call but also a window.load event, which refreshed the JS application.
My work around was to replace the <button>..</button> with an <input>..</input> field, see below:
<form class="form-search">
<label>Enter search string:
<input id="SearchString" type="text" class="input-medium search-query">
<!-- Broken: <button id="SearchAction" type="submit" class="btn btn-primary"> Search </button> -->
<!-- This works: -->
<input type="button" id="SearchAction" value="Go Find"/>
<img id="RssAction" style="vertical-align:bottom" src="images/feed-icon-14x14.png">
</label>
</form>
This may not be the root cause yet.

Opening Spring jsp in a popup window

My application needs a solution like Outlook mail: opening an other page as popup window on the parent window. The application is Spring 3 based and uses jsps. How do I make a popup out of my application page in order to make it work as intended at least in most common browsers?
I've tried target and window.open, without getting them work properly in Firefox.
Just as an example, the Spring travel sample app contains a jsp which is launched via a pop-up.
<a id="changeSearchLink" href="hotels/search?searchString=${searchCriteria.searchString}&pageSize=${searchCriteria.pageSize}">Change Search</a>
<script type="text/javascript">
Spring.addDecoration(new Spring.AjaxEventDecoration({
elementId: "changeSearchLink",
event: "onclick",
popup: true,
params: {fragments: "searchForm"}
}));
</script>
This shows how a link is decorated with an Ajax Event to launch searchForm.jsp when the link is clicked.

FireFox: strange behavior on submiting a form

Can anyone help with this strange form submiting in FireFox?
So this form should be submitted after pushing "go to submit" button. There is an onclick event on the button that should submit form through JavaScript. In the form there is another button "test" without any onclick event. Following the script, the form should be submitted only after pushing the "go to submit" button, but it submits even pushing at "test" button.
In the Internet Explorer it works well! But this stupid FireFox browser behaves different.
Here is example of HTML page:
<script>
function func(){
document.form1.submit();
}
</script>
<form name="form1" method="post" action="somewhere.php">
<button>test</button>
<input type="button" value="go to submit" onclick="func();">
</form>
I have several buttons with <button onclick="...">option 1</button> options. I want to fix strange submiting a form in FireFox. Help please!
http://www.w3schools.com/tags/tag_button.asp
The tag defines a push button.
Inside a button element you can put content, like text or images. This is the difference between this element and buttons created with the input element.
Always specify the type attribute for the button. The default type for Internet Explorer is "button", while in other browsers (and in the W3C specification) it is "submit".

Resources