I’m having problems trying to get data from a dhtmlXForm when using a dhtmlXLayout. I need to do this because according to docs.dhtmlx.com/doku.php?id=dhtm … orm_server I can “wrap dhtmlxForm conatinaer [sic] with HTML form tags and use HTML form submit to send data to server in common way”. The example shows a simple wrapping of the tag around a
So I thought about wrapping the form tag around the whole layout object but this is not working. I’ve created an example here so show what I mean. The files involved are:
- formtest.php: main page - damn you can’t attach anything without it saying “Not allowed”. Guess I’ll just paste it into this message.
- saveData.pl: Perl script that is the action of the form - merely dumps out what fields were passed to it
- formtext.xml: XML data describe the simple form
As it stands this formtest.php produces a simple form with a hidden field and 2 fields and a save button. Filling in the fields and hitting Save works as expected. Three fields are dumped out by saveData.pl, field0, field1 and field2.
Change the “useLayout = true” in formtest.php then you will see no layout at all! Moving the and inside the
From what I can tell the form and fields of the dhtmlXForm must occur right after the
So then, how do you get data from a dhtmlXForm that is contained in a dhtmlXLayout?
Pasting…
formtest.php:
[code]
Form test html, body { width: 100%; height: 100%; margin: 0px; overflow: hidden; }formtest.xml:
<?xml version="1.0"?>
<items>
<item name="field1"
type="input"
position="absolute"
inputLeft="100"
inputWidth="100"
label="field1"
>
</item>
<item name="field2"
type="input"
position="absolute"
inputLeft="100"
inputWidth="100"
inputTop="25"
labelTop="25"
label="field2"
>
</item>
<item name="save"
type="button"
command="save"
position="absolute"
inputLeft="50"
inputTop="50"
labelTop="50"
value="Save"
/>
</items>
saveData.pl:
!/usr/bin/perl
use warnings;
use strict;
use CGI qw (:standard :cgi-lib);
print header;
print start_html;
print h2 "saveData.pl";
print p "Parms passed in...";
my %parms = Vars;
foreach (sort keys %parms) {
print "$_: $parms{$_}<br>";
} # foreach