You are reading a single comment by @rive_gauche and its replies. Click here to read the full conversation.
  • Neither I'm afraid; any page number I enter results in page 1

  • Are you a developer? Do you have a JavaScript console?

    If you do... then you can help debug it. Because I cannot reproduce this at all, and the code makes perfect sense, so your specific version of IE9 is doing something funny.

    The code we are running is simply this:

    $('form[name=paginationByOffset]').submit(function(e){
    	console.log("Page jump requested")
    	var self    = $(this),
    		initial = self.attr('data-initial'),
    		limit   = self.attr('data-limit'),
    		max     = self.attr('data-max'),
    		value   = parseInt(self.find('input[type=text]').val()),
    		hidden  = self.find('input[name=offset]');
    	console.log("limit = " + limit + " , max = " + max + " , value = " + value);
    	if (!isNaN(value) && value >= 1 && value <= max && value != initial) {
    		console.log("Jump")
    		if (limit && value){
    			hidden.val(limit * (value-1));
    		}
    	} else {
    		console.log("Cancel jump")
    		e.preventDefault();
    	}
    });
    

    We have HTML that looks like this:

    <form
    	name="paginationByOffset"
    	method="GET"
    	data-initial="{{ pagination.page }}"
    	data-limit="{{ pagination.limit }}"
    	data-max="{{ pagination.total_pages }}"
    >
    	<input
    		type="text"
    		min="1"
    		value="{{ pagination.page }}"
    		max="{{ pagination.total_pages }}"
    		step="1"
    		pattern="\d*"
    		title="Enter the page number to jump to"
    		class="form-control"
    	/>
    	<input name="offset" type="hidden" />
    </form>
    

    All that happens is:
    1) A value is entered into the text field
    2) The form is submitted and the JavaScript fires
    3) The js pulls the value and makes sure it is a number
    4) If the number is different from whatever the default is, the form is submitted with the new value

    As the form is method=GET and the hidden field is named, the offset is put into the URL.

    This works everywhere, except your version of IE9. It even works on other versions of IE, which is why I haven't been able to solve it... I don't know which part is broken according to your browser.

About

Avatar for rive_gauche @rive_gauche started