Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by I.A on Nov 16, 2009 02:27
open dhtmlx forum
dhtmlxCombo - Form using GET instead of POST

Hi,

Here is my form with dhtmlxCombo:

<form method='GET' action='page2.php'>
<select id="cid" name="cname">
LOOP DATA
<option value='LOOP.ID'>LOOP.CNAME</option>
END LOOP
</select>
<script>
var a = dhtmlXComboFromSelect("cid");
a.enableFilteringMode(true);
</script>
<input type=submit>
</form>

Page doesn't pass value for the combo filed to next page. I assume this is because of using GET instead of POST?
Any solutions?

Thanks
Answer posted by Alex (support) on Nov 16, 2009 02:53

There is not difference either you use GET or POST method. Please, check the sample in the combo package:

dhtmlxCombo/samples/02_actions/03_combo_save.html

But in case of GET you should use use another approach on server to get the parameters: $_GET instead of $_POST

Answer posted by I.A on Nov 16, 2009 07:19
Thanks for a quick reply. I understand what you are saying and I know one must use $_GET for such scenarios.
But with my form the query string goes complete blank i.e mysite.com/page2.php?     (<- nothing gets passed as query string)
At the moment I am forced to do the following:
<form method='GET' action='page2.php'>
<input type="hidden" name = "cid">
<select id="cid1" name="cname">
LOOP DATA
<option value='LOOP.ID'>LOOP.CNAME</option>
END LOOP
</select>
<script>
var a = dhtmlXComboFromSelect("cid1");
a.enableFilteringMode(true);
a.attachEvent("onChange",function(){
      document.forms['form1'].elements['cid'].value = a.getSelectedValue();
})
</script>
<input type=submit>
</form>

Basically using the onChange event to assign the value to the hidden form field. and this works!. produces:
mysite.com/page2.php?cid=19
Answer posted by Alex (support) on Nov 16, 2009 08:47

Hello,

the issue wasn't reproduced locally. We have tested the dhtmlxCombo/samples/02_actions/03_combo_save.html sample ( teh sample from the combo package, but with GET instead of POST):