No announcement yet.

How add an input field to a grid...

  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Hi Hiram,
    thanks so much.
    At the end ... something is running quite fine.

    This is the two part of code I used. I leave here also as sample for other people that do not chew so much coding like me .. ;-)
    Showing your hints to a programmer he give me some additional lines. I don't know if they all are needed but now it works.


    if (isset($_POST['id'])){
    [glo_ProductID] = $_POST['id'];
    if (isset($_POST['name'])){
    [glo_ProductName] = $_POST['name'];
    if (isset($_POST['supplier'])){
    [glo_SupplierID] = $_POST['supplier'];
    if (isset($_POST['category'])){
    [glo_CategoryID] = $_POST['category'];
    if (isset($_POST['company'])){
    [glo_CompanyID] = $_POST['company'];
    if (isset($_POST['price'])){
    [glo_UnitPrice] = $_POST['price'];
    if (isset($_POST['quantity'])){
    [glo_QuantityRow] = $_POST['quantity'];

    {col}= "<input type='text' size='6' onchange='myfunction(\"{ProductID}\",\"{ProductNam e}\",\"{SupplierID}\",\"{CategoryID}\",\"{CompanyI D}\",\"{UnitPrice}\", this.value)'>";

    echo '<script>
    function myfunction(id, name, supplier, category, company, price, quantity){
    var xmlhttp;
    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
    {// code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    xmlhttp.send("id="+id+"&name="+name+"&supplier="+s upplier+"&category="+category+"&company="+company+ "&price="+price+"&quantity="+quantity.toString ());


    Additional question
    1. I need to check also if the item "price" is different from zero and if it zero I need to alert that is not possible to order an item without price.
    Is it also that a JS matter to add before to close with </script>'; ??
    How can I write the sintax of test ?

    If (price <= 0) { alert("Attention Only item with price are accepted...."); }

    Many thanks again !!!
    Last edited by giovannino; 01-05-2015, 02:17 PM.


    • #17
      Hi Hiram,
      I got some problems becouse my ignorance about JS.
      When you say "Please note that this javascript code only shows the values dont send any data to your Blank app " .
      This is probably my problem.
      I'm using the code I posted here and everything works BUT the quantity field that is always empty.
      Using console the value of quantity is correct but when I use

      if (isset($_POST['quantity'])){
      [glo_QuantityRow] = $_POST['quantity'];

      the global variable is always empty.
      I'm really stucked here and I don't really what can fix this problem.


      • #18
        Originally posted by aducom View Post
        In a standard grid you cannot add fields. If you need that then you need to create a multiple record form.
        I have to agree with Albert.

        Although you can make it work with grid, you should remake your app as a form, You can quickly replicate this behavior as a form, except for the refined search, but you may have a normal filter / search in there.

        Do what you want inside a grid can be done, but its tricky.

        Development Team
        Netmake - IT Solutions