After Im using jquery mobile to submit a form,
but after submition, and going back to form, all fields are not in default value any more. they showing data previously submitted.
(if I press f5, form will reset and works fine for another round only)
Im guessing something remain in browser cache.
Any Idea?
<!DOCTYPE html>
<html>
<head>
<script src="scripts/jquery-1.9.1.min.js"></script>
<script src="./scripts/jquery.mobile-1.3.0.js"></script>
<link rel="stylesheet" href="./style/jquery.mobile-1.3.0.min.css" />
</head>
<body>
<?php if(!(isset($_GET["submit"]))){ ?>
<form action="thisPage.PHP?submit=yes" method="get" >
<input type="text" value="0" />
<input type="submit" value="Submit" />
</form>
<?php }else{ ?>
<a href="thisPage.PHP" > FINISHED</a>
<?php } ?>
</body>
</html>
Finally I found the simple and easy answer:
add following line into form tag:
data-ajax="false"
so it should be like this:
<form action="thisPage.PHP?submit=yes" method="get" data-ajax="false" >
Related
I've got LinkedIn API app created and I'm able to get to the 'Allow' screen. That redirects to a form on my site which is submitted to linkedin.com to complete the authorization.
Instead of redirecting to my redirect url I'm getting an error saying:
"You must be authenticated to access this page".
Below is the form I'm submitting except that I've replaced the form field values with fakes.
I've made sure the real redirect URL is authenticated in my LinkedIn application.
What am I doing wrong?
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SoftLink Systems LinkedIn Auth Completion</title>
</head>
<body>
<form id="frmLNAuthComplete" action="https://www.linkedin.com" enctype="application/x-www-form-urlencoded" method="post" >
<input type="hidden" name="grant_type" value="authorization_code" />
<input type="hidden" name="code" value="FAKE_CODE_Gdy1R3cW2hFACX2dV39QwfofGVXg6v1nPH0O_Em4UnzEaR06ZXDGO57HU0DukpehS-EGu-AzF3L8SG8XfrB6oYRkpPtY3cLc" />
<input type="hidden" name="redirect_uri" value="http://linkedin.fake-domain.com/index.php" />
<input type="hidden" name="client_id" value="fake-id-k66l" />
<input type="hidden" name="client_secret" value="fake-secret-rI2mxlqb" />
</form>
<script type="application/javascript">
var frm = document.querySelector("#frmLNAuthComplete");
frm.submit();
</script>
</body>
</html>
I have a html page and i am sending some parameter using post method.
now i want to get these parameter on gwt client.
is there any method in gwt to get post parameter on client.?
i use following code
<html>
<body>
<form action="http://localhost:8080/popnnn/js.html" method="post">
<input type="text" id="foo" name="foo">
<input type="submit" value="Send" name="submit" id="submit">
</form>
</body>
</html>
and in my gwt code
TextBox text=new TextBox();
text.setText(Window.Location.getParameter("foo"));
this is perfectly woking with get method but not with post
please help......
Steps to follow:
Just convert the file js.html to js.jsp.
Get the post parameter from the request parameter.
Set the value in hidden div in JSP and access it in JAVA.
Change the action attribute of form tag as shown below:
<form action="http://localhost:8080/popnnn/js.jsp" method="post">
Try any one:
JSP Scriplets
<div id="fooParameter" style="visibility: hidden;">
<%=request.getParameter("foo") %>
</div>
JSP Standard Tag Library
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<div id="fooParameter" style="visibility: hidden;">
<c:out value="${param.foo}" />
</div>
Access value from hosted HTML/JSP to JAVA code
String foo = RootPanel.get("fooParameter").getElement().getInnerHTML();
TextBox text=new TextBox();
text.setText(foo);
Find a sample code here about Acces value between two jsp with jstl
I'm trying to create a Lift chat server. I've taken everything straight from the Lift book that is linked to from Lift's main website. Upon running it, I cannot submit my messages because liftAjax is undefined and causes an error that appears in my chrome console.
Correct me if I'm wrong, but shouldn't Lift generate the liftAjax stuff upon starting up the website? I have a feeling I could import liftAjax myself from some source and it would work, but I don't feel I should have to do this.
This is my index.html file.
<!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">
<head><title>Home</title></head>
<body class="lift:content_id=main">
<div id="main" class="lift:surround?with=default;at=content">
<!-- the behavior of the div -->
<div class="lift:comet?type=Chat">Some chat messages
<ul>
<li>A message</li>
<li class="clearable">Another message</li>
<li class="clearable">A third message</li>
</ul>
</div>
<div>
<form class="lift:form.ajax">
<input class="lift:ChatIn" id="chat_in" />
<input type="submit" value="Say Something" />
</form>
</div>
</div>
</body>
</html>
This is what is generated:
<?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">
<div id="main" xmlns="http://www.w3.org/1999/xhtml">
<!-- the behavior of the div -->
<div id="F156429460218VSI1GX_outer" style="display: inline">
<div id="F156429460218VSI1GX" style="display: inline">
<div xmlns="http://www.w3.org/1999/xhtml">Some chat messages
<ul>
<li></li>
</ul>
</div><script type="text/javascript">
// <![CDATA[
/* JSON Func comet $$ F156429460221QEXVXK */function F156429460221QEXVXK(obj) {liftAjax.lift_ajaxHandler('F156429460221QEXVXK='+ encodeURIComponent(JSON.stringify(obj)), null,null);}
// ]]>
</script></div><script type="text/javascript">
// <![CDATA[
var destroy_F156429460218VSI1GX = function() {}
// ]]>
</script></div>
<div>
<form id="F156429460223BHVYIM" action="javascript://" onsubmit="liftAjax.lift_ajaxHandler(jQuery('#'+"F156429460223BHVYIM").serialize(), null, null, "javascript");return false;">
Note: the error happens on the above line
<input name="F1564294602245ECYAU" id="chat_in" xmlns="http://www.w3.org/1999/xhtml" />
<input value="Say Something" type="submit" xmlns="http://www.w3.org/1999/xhtml" />
</form>
</div>
</div>
I'm just not really sure what could be causing this. I'm just starting to learn Lift so I do not know much. Am I missing something?
If you need more information, such as build.sbt or other files just let me know and I can post them as well.
In my case, I was missing following body part that automatically seems to source liftAjax.
<body class="lift:content_id=main">
<div id="main" class="lift:surround?with=default;at=content">
......
</div>
</body>
But, in another case, sourcing jquery manually would work with JQuery module injected in Boot.scala.
<script id="jquery" src="/classpath/jquery.js" type="text/javascript"></script>
You don't need to manually include the liftAjax function, but you do need to include jquery manually. Lift will not automatically inject a reference to it since it doesn't know what version, minification level, or location you want to use. Try adding:
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
To the head section of your template.
I've a website used by over 500,000 people, but a tiny few (about 20) are reporting that one of the forms resets when clicking "submit".
I've stripped out other code, but the HTML in the FORM tags is complete:
<!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" xml:lang="en" lang="en" dir="ltr">
<body>
<form id="fProfile" action="/cv.html" method="post" enctype="multipart/form-data">
<div class="row"><label for="fName">Your Name:</label><input type="text" id="fName" name="text" /></div>
<div class="row"><label for="fEmail">Your Email:</label><input type="text" id="fEmail" name="email" /></div>
<div class="row"><label for="fCvFile">Your CV:</label><input type="file" id="fCvFile" name="cv" /><em>Please only attach a CV, up to 200kb in size.</em></div>
<input type="submit" class="submit" name="go" value="Save CV" />
</form>
</body>
</html>
There is no JavaScript involved and the form could not be simpler!
Feedback is limited, but it's being reported that this happens on MSIE/Chrome/Firefox. It must be third party software interupting the form but reports come in from computers with McAfee/AVG/Avast. I can't find a single common factor other than the HTML ...
All reports say that the form resets on clicking the submit "Save CV" button without attempting to load a page but I'm unable to replicate this.
I've never come across anything like this and am hoping one of you have!
Thanks for any help or guidance.
EDIT: I've added a name/email input form too to show that it is just the type=file input that is resetting. The remainder of the form holds on to the entered text.
It says you are posting to a HTML page - surely you would need to post to a PhP page or similar.
So basically when you hit submit the page is just refreshing. Also in your HTML page you should always have a head tag.
I would like to create a form where the user can put a number in like "12345" and when the submit button is clicked have the result be http://www.URL.com/12345
Do you need that data to be posted somewhere, or do you just want to jump to that location?
You could try without a form:
<label for="number">Number: </label>
<input type="text" id="number" /><br />
<input type="button"
onclick="window.location='http://www.URL.com/'+document.getElementById('number').value;" />
Here's the jQuery version separating the events from the markup. Demo can be seen here
<html>
<head>
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script>
var url="http://www.url.com/";
$(document).ready(function(){$("#go").click(function(){
url+=$("#parameter").val()
window.location=url;
});
});
</script>
</head>
<body>
<input type="text" id="parameter"/>
<button id="go">Go</button>
</body>