FireFox: strange behavior on submiting a form - firefox

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".

Related

how to update jquery mobile popup dialog using 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.

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.

dojo.connect not working in IE but sometimes in chrome&firefox

I finally got some parts working here: http://jsfiddle.net/trXBr/5/
but when I put the code back into my project and tried to browse using internet explorer; the button onclick events do not work. Interestingly the one button onclick function to show the dialog works in firefox and chrome. I was excited to have this working in the editor but now if this does not work with all browsers, then this is just really frustrating. I am using version 1.5.1
dojo.connect(loadBtn,'onClick',function(){
userDialog.show();
});
dojo.connect(butt,'onClick',function(evt){
showTab();
});
Any help/ideas appreciated.
EDIT:
Ok using the compatibility mode in IE helps to get the one function working which displays the dialog box.
So as you can see here I have an borderlayout where I want a tabcontainer to be displayed in the middle with a click of a button and this works fine in jsfiddler but not from my code in the browsers;
<div dojoType="dijit.layout.ContentPane" region="center" splitter="true">
<div id="mainTabContainer"dojoType="dijit.layout.TabContainer"
style="width:500px;height:100px;display:none">
<div id="tab1" dojoType="dijit.layout.ContentPane"
title="First Tab" selected="true"
closable="true">First Tab</div>
<div id="tab2" dojoType="dijit.layout.ContentPane"
title="Second Tab" closable="true">
Second Tab
</div>
</div>
</div>
so the display:none but when I click the button I call the following:
dojo.connect(butt,'onClick',function(evt){
showTab();
});
function showTab(){
dijit.byId("mainTabContainer").domNode.style.display = 'block'
dijit.byId("mainTabContainer").resize();
}
Also if I remove the display=none then the tabcontainer appears fine. So is these something wrong with my function call.
ok sorry guys....all my fault here...I forgot to remove the added code I had in my html in my asp.net code
<body class="claro">
<form id="form1" runat="server">
<asp:ScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ScriptManager>
Once I removed the form and scriptmanager lines it works fine..Thanks for everyones efforts.
Just worried that if I were to incorporate ajax and other controls, then would dojo still work

Resources