- Screen name: edcincy
edcincy's Profile
3 Posts
3 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- All...
On my JSP register page, I have a password entry field, and "Male" "Female" radio buttons.
They are set up to display side by side.
<div align="center">
<div style="width:300px;">
<fieldset class="ui-grid-a" style="height:75px;">
<div class="ui-block-a" style="padding-top:10px;">
<label for="registerPassword">Password</label>
<input type="password" name="usrPassword" id="registerPassword" autocapitalize="none" style="width:145px;" value="${requestScope.usrPassword}" />
</div>
<div class="ui-block-b" >
<fieldset data-role="controlgroup" data-mini="true" data-type="horizontal" style="padding-top:39px; padding-left:20px;">
<input type="radio" data-theme="a" name="usrGender" id="registerMale" value="male" />
<label for="registerMale">Male</label>
<input type="radio" data-theme="a" name="usrGender" id="registerFemale" value="female" />
<label for="registerFemale">Female</label>
</fieldset>
</div>
</fieldset>
</div>
If the form is submitted with errors, I want the page to refresh with the radio button that was chosen to again be selected.
In the response, I am returning the value of the selected radio button.
I use Java to process the request variable, and call Javascript to set the radio button...
<c:choose>
<c:when test="${requestScope.usrGender == 'male'}">
<script type="text/javascript">
alert("here");
$('input:radio[name="usrGender"]').filter('[value="male"]').prop('checked', true);
</script>
</c:when>
<c:when test="${requestScope.usrGender == 'female'}">
<script type="text/javascript">
$('input:radio[name="usrGender"]').filter('[value="female"]').prop('checked', true);
</script>
</c:when>
</c:choose>
Everything works fine except for setting the radio button.
I have an alert that displays "here" when the "male" button value is returned.
So I know that the code is getting to that point.
I must not be properly setting the radio button.
Am I not properly finding it in the fieldset?- I am having issues with submitting forms using JQM and Google App Engine.I am using Java on the App Engine.I am also testing this on my iPhone and iPhone simulator.Currently I have two simple forms... a registration form, and a login form.Using the default JQM AJAX form submission, the registration form works fine.The problem occurs with the login form.When entering the username/password and tapping "Login", the form simply does not submit.Here is my latest try...The form:
<form id="loginForm" >
<label for="loginEmail">Email:</label>
<input type="email" name="usrEmail" id="loginEmail" autocapitalize="none" />
<div style="width:100%; height: 8px;"></div>
<label for="loginPassword">Password: </label>
<input type="password" name="usrPassword" id="loginPassword" autocapitalize="none" style="width:145px;"/>
<div style="width:100%; height: 20px;"></div>
<div align="center">
<input type="submit" id="loginSubmitButton" data-mini="true" data-inline="true" data-theme="b" value="LOGIN" >
</div>
</form>
The Javascript:$(document).ready(function() {
$("#loginSubmitButton").on("click", function()
{
var formServlet = "/form/loginUserForm";
$.ajax({
type: "POST",
url: formServlet,
data: $("#loginForm").serialize(),
success: function(data)
{
$.mobile.changePage( "/mobi", { transition: "pop"});
}
});
return false;
});
});
In the desktop browser, it all works fine.When I try the same code using Mobile Safari on my iPhone, the form does not submit.I have logging in my Java Servlet code which I can see in the App Engine logs.When I attempt to submit using Mobile Safari... no logging shows.BUT... the "mobile.changePage" runs and takes me back to the home screen with the correct "pop" transition.I am completely stumped here.Thanks in advance..,-- Ed- This has really go me stumped.Using jQuery Mobile, I have in my form...
<label for="email">Email:</label>
<input type="email" name="email" id="email" style="height:15px;"/>
Which seems pretty simple. But the height will only take effect if I refresh the browser (Mobile Safari).The page with the form is a separate page in itself. It is also a JSP page, which I don't think would be a culprit. My custom CSS works on all my other JSP pages.But seeing as this is an inline style, why would it only be applied after a refresh?Is it due it being a form? Do I need to somehow specifically call a refresh on this page?Thanks in advance!-- Ed- «Prev
- Next »
Moderate user : edcincy
© 2012 jQuery Foundation
Sponsored by
and others.


