Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by John-Olav Hoddevik on Dec 10, 2008 05:09
open dhtmlx forum
Submit grid to form

I'm not able to submit changed rows in my grid to a form. I've inluded js/dhtmlxGrid/codebase/ext/dhtmlxgrid_form.js and put the grid inside form-tags.

But when I do print_r($_POST) I get no variables from the grid? Am I missing something?
Answer posted by Support on Dec 10, 2008 07:04
By default functionality expects that you are using submit button for form sending. 
If you are senging form by js code, you need to add line , which will prepare grid for data sending

grid.parentFormOnSubmit();
form.submit();
Answer posted by John-Olav Hoddevik on Dec 11, 2008 01:55
Well, I'm submitting with a submit button.  I tried adding this code: onsubmit="mygrid.parentFormOnSubmit()"

Here is my code:
<form action="prislapp_kamp.php" method="post" name="prislapp" target="ny" onsubmit="mygrid.parentFormOnSubmit()"><br>
        <div style="position:relative;float:left;margin-left:30px;">
        <br />
        A4 <input type="radio" name="type" value="a4" onclick="document.getElementById('format').src='../design/gfx/a4.gif';" checked><br />
        A5 <input type="radio" name="type" value="a5" onclick="document.getElementById('format').src='../design/gfx/a5.gif';"><br />
        A6 <input type="radio" name="type" value="a6" onclick="document.getElementById('format').src='../design/gfx/a6.gif';"><br />
        </div>
        <div style="position:relative;float:left;margin-left:10px;height:75px;">
        <img src="../design/gfx/a4.gif" id="format" alt="Format" align="bottom" border="1" style="position:absolute;bottom:0px;">
        </div>
        <div class="clearer">&nbsp;</div><br />
        <input type="submit" value="Lag prislapper" name="submit"><br />
        <div id="gridbox" style="position:relative;width:inherit;overflow:visible;"></div>   
        <script>
        <!--
            mygrid = new dhtmlXGridObject('gridbox');
            mygrid.imgURL = "js/dhtmlxGrid/sources/imgs/";
           mygrid.setHeader(",Varenr, Pris, Tittel, Tekst, Pristekst, Mont.");
       
            mygrid.setInitWidths("20,100,40,*,*,60,50");
            mygrid.setColAlign("center,left,left,left,left,left,left ");
            mygrid.setColTypes("ch,ro,ed,ed,ed,ed,ro");
            mygrid.setColSorting("str,str,int,str,str,str,str");
            mygrid.enableKeyboardSupport(true);
            //mygrid.enableSmartRendering(true);
            mygrid.setSkin("otshop");
            mygrid.enableAutoHeigth(true);
            mygrid.enableDistributedParsing(true);
            //mygrid.submitOnlyChanged(true);
            mygrid.enableEditEvents(true, false, true);
           mygrid.enableColumnAutoSize(true);
           
            mygrid.init();
       
            mygrid.loadXML("lst_kampanje.php?kampanje={KAMPANJE}");
        -->
        </script>   
        </form>
Answer posted by Support on Dec 11, 2008 02:59
Problem can't be reconstructed locally. 
Working sample which uses the same init code sent by email, after changing anything in grid and submiting the form, data about changed cell included in submit. 
Answer posted by John-Olav Hoddevik on Dec 11, 2008 03:53
Have not received any working sample. Is it possible to post here?