last day (15 days later) » 

5:31 AM
hey sir can we discuss here?
 
ok
sir with those stars I have 2 input field also
so on click of button I am making an ajax call and sending data to my server
$('#submit').click(function(){
				$.ajax({
					'url': 'CustomerFeedbackServlet',
					'method': 'POST',
					'data' : $('#container').serialize(),
					 'success': function(data){

					 },
					 'error': function(err){
                          alert(err)
						}
				});

			});
like this
and At my back end I am using java servlets to get data
 
And you got an error?
 
no I am not getting the approach how to do that
just a minute I ll show you how I am doing it
protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		String foodQlty = request.getParameter("FOODQUALITY");
		String Cleanliness = request.getParameter("CLEANLINESS");
		String inputField = request.getParameter("cName");

		System.out.println(foodQlty+" : "+Cleanliness);

		doGet(request, response);
	}
above is my do get method
 
and you get nothing in Cleanliness?
 
5:41 AM
no I am getting that too
the issue is
as I am appending my div which is having stars dynamically through JSON data
currently there are 5 attributes, as it is dynamic some time it can be 2 or 3 also
so I can't do it this way String foodQlty = request.getParameter("FOODQUALITY");
suppose there is no foodquality on UI
how can I get data dynamically is my issue
this is how I have to save my data in db
all excellent good verygood I have in other table saved which i ll get by stars value
you there sir?
 
I'm not a java dev but as I read in the docs, getParameter() will return null if the parameter does not exist. So maybe you can check if it's not null then save it to your db
But if it's not what you need, you should ask a new question in SO because I don't have any experience with java
 
sir there parameters are not fixed they can be 5 sometime 10, some times 7 so I have to write all of them at once and check or null
@CuongLeNgoc yup I am also thinking about that
and sir this loop will be like this only ++ for (j = 1;j<=5; j++)
 
getParameterNames() Maybe this method can give you the list of parameters
what do you mean?
 
because that excellent vgood good avg poor are in reverse order excellent is 1, so when user will select all five stars that means it is excellent
 
No. As i explained in the answer, you star have css float: right
if you do for (j = 1;j<=5; j++)
the star have value 5 will be the first star
on the left
 
5:53 AM
ok so you are saying to change css to float : left?
 
Oh wait
 
I think you haven't made the change
 
You want the star with value 1 is excellent
or 5 is excellent?
 
1 is excelent
by giving float left it is working differently , i thing taking j++ will be the correct approach
 
So i misunderstood
 
5:56 AM
yupp
 
But you still need the star is red when you select the first star
So if using j++, you need to change the css or the class of dynamic element
 
yup for that I have changed my css in place of star-5 Have put star -1
input.star-1:checked~label.star:before {
  color: #FE7;
  text-shadow: 0 0 20px #952;
}

input.star-5:checked~label.star:before {
  color: #F62;
}
like this this is doing it correctlly
 
Yeah
You should mention info like 1 is excellent in your question next time
 
this is to working fine, the main thing is inserting the data, I am getting any approach to do that
 
Did you try the method i suggest above?
 
6:04 AM
I am working on that
that I don't know how it will work,bit of confusing
it is
 
what do you mean?
 
need to store that in array or string It says on google, I don't have much knowledge that's why googling it
 
6:51 AM
sir If there is no star selected how can I prevent form to sbmit?
 
you can add required attribute to the input
 
no I am doing it with click event so I want to populate alert, because on sumbit required will work and it will also reload the page, reload I don't want
 
7:06 AM
Maybe this will help
17
A: checking each required input for empty value with jQuery

Šime VidasThis? $( ':input[required]', yourForm ).each( function () { if ( this.value.trim() !== '' ) { // ... } }); where yourForm is a reference to the FORM element (you can also use a selector here). This is the context - you only want to search for fields inside the form.

 
 
5 hours later…
12:04 PM
@manishthakur Are you still there?
 
12:19 PM
Please check this fiddle: jsfiddle.net/6uas2n9f
 

last day (15 days later) »