Jump to content

funbinod

Members
  • Posts

    501
  • Joined

  • Last visited

Posts posted by funbinod

  1. u r right. i appreciate ur guidance so far and this suggestion. but since i'm beginner i know less. if u guide me through the process it would itself make me do it myself next time (on other relative processes also). so i expect ur kindly appearance till this problem is solved.

     

    i think this is what u expected to know for the value assigned for this. (or i'm not sure)... :P

        $('form').on('submit', function (e) {        e.preventDefault();        var form = this;        confirmDialog('Confirm', 'Are you sure?', function () {			form.submit();        });    });
  2. on line 87

                    buttons: {                    Yes: function () {			console.log("The function is running", success);                        success();                        $(this).dialog("close");                    },                    No: function () {                        $(this).dialog("close");                    }                },                close: function() {                    $(this).remove(); // line 87
  3. the following script to ask for confirmation before submitting a form is not working while clicking yes. please guide me find the error...

    <script>$(function () {    'use strict';    function confirmDialog(title, message, success) {        var confirmdialog = $('<div></div>').appendTo('body')            .html('<div><h6>' + message + '</h6></div>')            .dialog({                modal: true,                title: title,                zIndex: 10000,                autoOpen: false,                width: 'auto',                resizable: false,                buttons: {                    Yes: function () {                        success();                        $(this).dialog("close");                    },                    No: function () {                        $(this).dialog("close");                    }                },                close: function() {                    $(this).remove();                }            });        return confirmdialog.dialog("open");    }    $('form').on('submit', function (e) {        e.preventDefault();        var form = this;        confirmDialog('Confirm', 'Are you sure?', function () {			form.submit();        });    });});</script>
  4. i was trying to get some value according to value entered to form <input> field. but it returns value only to another <input> field but not to <div>s or <span>s. i wonder what is the problem. here is what i tried

     

    // this is ajax script

    // get cqtyfunction getCqty(){var XMLHttpRequestObject;// ...............// ...............if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {	document.getElementById('cqty').value = XMLHttpRequestObject.responseText;}}var icode = document.getElementById('icode').value;XMLHttpRequestObject.open('POST', 'ajax/cqty.php');XMLHttpRequestObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");XMLHttpRequestObject.send("icode=" + icode);}

    // this is cqty.php

    <?require_once('../functions.php');header("content-type: text/xml");$icode = trim($_POST['icode']);$sql = mysqli_fetch_object(mysqli_query($connect, "select * from stock where icode='$icode'")) or die(mysqli_error($connect));$item = $sql->item;$unit = $sql->iunit;$sid = $sql->sid;$oqty = $sql->oqty;$sql1 = mysqli_fetch_array(mysqli_query($connect, "select sum(pqty),sum(sqty) from tran where sid=$sid")) or die(mysqli_error($connect));$pqty = $sql1['sum(pqty)'];$sqty = $sql1['sum(sqty)'];$cqty = $oqty + $pqty - $sqty;echo "( " . $cqty . " " . $unit . " )";?>

    and this is client side

    <tr>    <td align="right">Item Code: </td>    <td>    <input type="text" name="icode" id="icode" onkeypress='return tabE(this,event)' onchange="getRate();getItem();getCqty()" />    </td></tr><tr>    <td align="right" width="100px">Item Name:</td>    <td>    <input name="item" id="item" onkeypress='return tabE(this,event)' /><!-- value returns fine here. but if i used <div> or <span> in stead of <input>, nothing is displayed-->    </td></tr>

    can anyone please help me find out the problem...

  5. You can control the order of elements that tab will cycle through by adding tabindex to elements with number indicating it's order.

    http://www.w3schools.com/tags/att_global_tabindex.asp

     

    i even tried that but it didnt do what i(and u too) expected. dunno what is the problem.

     

    and i could not even understand what @justsomeguy is pointing me towards. sorry!

     

    but now i changed my autosuggest script like this and it worked...

    <?php$sql = mysqli_query($connect, "select * from stock order by item") or die(mysqli_error($connect));while ($row = mysqli_fetch_assoc($sql)) {	$items[] = $row['item'];}$namesql1 = mysqli_query($connect, "select * from account order by name") or die(mysqli_error($connect));while ($namerow1 = mysqli_fetch_assoc($namesql1)) {	$name[] = $namerow1['name'];}?><script type="text/javascript" src="jquery-2.1.0.js"></script><script src="jquery-ui-autocomplete.js"></script><script type="text/javascript">$(function() {	var items = <?php echo json_encode($items); ?>;	$("#item").autocomplete({		source: items	});	var name = <?php echo json_encode($name); ?>;	$("#name").autocomplete({		source: name	});});</script></head><body onload="document.getElementById('name').focus()"><input name='name' id='name' onkeypress='return tabE(this,event)'><input name="item" id="item" onkeypress='return tabE(this,event)' />

    thank u for ur company...

  6. i was using simple ajax method to getData stored on 'items.php' and insert it on the "<td id='items'> </td>"

     

    i've this already in my page.

    <td id="item"><script>getData("items.php", "item")</script></td>

    it displays everything fine. i wish to add this same line again. but when i .append this element it doesn't work..

  7. uh huh! ok! i got it. but i dunno if it has done as what u explained or not coz i found this plugin on the web..

     

    and i wonder if (or though) it has replaced <select> element with <input> why the "id" is not working (like for CSS & body onLoad)? and if i manually change <select> as <input> everything work fine - "enter as tab", CSS, <body onLoad) -- all work...

     

    here is the jquery i used for data sorting

    <script type="text/javascript" src="jquery-2.1.0.js"></script>	<script src="jquery.js"></script>	<script src="jquery-ui-autocomplete.js"></script>	<script src="jquery.select-to-autocomplete.min.js"></script>	<script type="text/javascript" charset="utf-8">	  (function($){	    $(function(){	      $('select').selectToAutocomplete();//	      $('form').submit(function(){//	        alert( $(this).serialize() );//	        return false;//	      });	    });	  })(jQuery);	</script>
  8. i was trying to replace enter key with the 'tab' function. but it returned strange error.

     

    it is working for all <input> elements but not working for <select> elements. along with this, CSS and <body onLoad ...... focus()> also are not recognizing it with its "id". but when i change <select> to <input>, everything work fine...

     

    one thing more -- <select> element contains php array value and is configured with jquery for autocomplete....

     

    below is what i tried---

    <script type="text/javascript">   function tabE(obj,e){    var e=(typeof event!='undefined')?window.event:e;// IE : Moz    if(e.keyCode==13){      var ele = document.forms[0].elements;     for(var i=0;i<ele.length;i++){        var q=(i==ele.length-1)?0:i+1;// if last element : if any other        if(obj==ele[i]){ele[q].focus();break}      }   return false;    }   } </script> </head><body><input name='ref' type='text' id='ref' onkeypress='return tabE(this,event)' /><input name='date' type='text' id='date' onkeypress='return tabE(this,event)' value='".date('Y-m-d')."' style='text-align:right' /><select name='name' id='name' autofocus autocorrect='off' autocomplete='off' onkeypress='return tabE(this,event)'><option value='' selected='selected'></option><?php// ........................while ($row = mysqli_fetch_array($result))	{	echo "<option>" . $row['name'] . "</option>";	}?></select>
  9. i am trying to create new element that contains a php returned array in it.

    $( "#invoice" ).append( '<td id="item"><script>getData("items.php", "item")</script></td>');

    the array is returned from 'items.php' and is called with simple ajax technique. its not working, or simply i don't know how can i do that. can anyone please guide me or suggest me some better technique...?

  10. i'm learning ajax along with javascript. while learning i'm trying something as responseText. what i tried works fine on CHROME version 36(dev) but doesn't work on Internet Explorer version 11.

    this is what i tried

    <head><script type="text/javascript">var XMLHttpRequestObject = false;if (window.XMLHttpRequest) {	XMLHttpRequestObject = new XMLHttpRequest();} else if (window.ActiveXObject) {	XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHttp");}function getData(dataSource, divID){	if(XMLHttpRequestObject) {		var obj = document.getElementById(divID);		XMLHttpRequestObject.open("GET", dataSource);				XMLHttpRequestObject.onreadystatechange = function()		{			if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {				obj.innerHTML = XMLHttpRequestObject.responseText;			}		}				XMLHttpRequestObject.send(null);	}}</script></head><body><table><tr><td><a id="note" href="javascript:getData('note.php?', 'note')" class="link">Note</a></td><td id="note"></td></tr></table>

    please help me find what i missed........

  11. i'm trying to learn jquery. while learning i'm trying autosuggest and i tried this

    <script type="text/javascript">	function lookup(inputString) {		if(inputString.length == 0) {			// Hide the suggestion box.			$('#suggestions').hide();		} else {			$.post("item.php", {queryString: ""+inputString+""}, function(data){				if(data.length >0) {					$('#suggestions').show();					$('#autoSuggestionsList').html(data);				}			});		}	} // lookup		function fill(thisValue) {		$('#inputString').val(thisValue);		setTimeout("$('#suggestions').hide();", 200);	}</script>

    it is working properly... but i wish the suggestion could be selected using up and down arrows on keyboard. can anyone suggest how can i do that?

  12. Hello,

    Pls, my root@localhost lost privileges. I might have mistakenly done that. Please help, i cant do anything in mysql right now. I cant CREATE, SELECT and all other privileges are gone. Pls help.

    Thanks

    you should post a new topic. dont ask any question on any other topic....

  13. there is no reason not to believe u. i'm nothing in comparison to a php tycoon like u. i was just asking for other possible reasons for it.

     

    and now i found it. shame on me. i just forgot to place method="post" into the form.

     

    thank u for ur company.

  14. its again something different @Ingolme, i think.

     

    the referer page that i want to redirect back to is not a success page. its the page from where i reached to the edit page and i want to redirect back to the same page after editing the information including success messege....

     

    this is the chain (or cycle) ===>

    1. report.php => edit.php => editpost.php => report.php (with success messege)
    2. customer.php => edit.php => editpost.php => customer.php (with success messege)

    in this way won't the action checking code give error when i visit the page before i redirect through editpost.php?
  15. i just wish to display the "success messege" just above the "redirected page"

     

    and can't i retrieve referrer page just as file name? not as full address including document root?

    like http referer gives "http://localhost/referer.php?" but can i get just "referer.php"?

    it will be helpful if i use different server for different users.....

×
×
  • Create New...