We help IT Professionals succeed at work.
Get Started

jquery mobile checkbox validation

arielbf
arielbf asked
on
335 Views
Last Modified: 2015-07-20
I'm trying to have this form - however the validation is not working... any ideas?

<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Expires" CONTENT="0">
<!-- Include meta tag to ensure proper rendering and touch zooming -->
<meta name="viewport" content="width=device-width, initial-scale=1">

<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<link href="css/themes/default/rtl.jquery.mobile-1.4.0.css" rel="stylesheet" />
<script src="js/rtl.jquery.mobile-1.4.0.js"></script>
</head>

<body>

<div data-role="page">

<div data-role="header" data-theme="b">
    <h1>title</h1>
</div>


<div data-role="content">
    <fieldset>
	
	<form action="try.html" name="form1" method="post" data-ajax="false" class="ui-body ui-body-a ui-corner-all">

	
	
	<fieldset data-role="controlgroup">
	<legend>checkboxes (please check 2 options)</legend>		
	
	
	<p>
		<input type='checkbox' name='q2[]' id='q2_0' value='0' maxlenght="2" minlength="2">
		<label for="q2_0">answer0</label>
		
		<input type='checkbox' name='q2[]' id='q2_1' value='1'>
		<label for="q2_1">answer1</label>
		
		<input type='checkbox' name='q2[]' id='q2_2' value='2'>
		<label for="q2_2">answer2</label>
		
		<input type='checkbox' name='q2[]' id='q2_3' value='3'>
		<label for="q2_3">answer3</label>
		
		<input type='checkbox' name='q2[]' id='q2_4' value='4'>
		<label for="q2_4">answer4</label>
		
	</fieldset>
	
	
			<input type="hidden" value="3450" name="qid">			
			<input type="hidden" value="57350.47" name="st">			
			<input type="submit" data-theme="b" value="submit" id="submitButton" name="continue">
			
		</form>
		
		<script type="text/javascript" src="http://www.midgampanel.com/mobile/dist/localization/messages_he.js"> </script>
		<script>
		$("form1").validate();
		</script>
		
</fieldset>
</div>
</div>

<script>				
	function hidesubmit(){
	  $("#submitButton").closest("div").hide();
	  $("#q2_0").hide();
	}
	function showsubmit(){
	  $("#submitButton").closest("div").show();
	}
setTimeout(hidesubmit, 0);
setTimeout(showsubmit, 2700);
</script>

</body>
</html>

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Expert of the Year 2008
Top Expert 2008
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE