- Code: Select all
<If: Sub: isNewValue: CustomField_produktgruppe>
<a name="<Field: CustomField_produktgruppe>">
<tr><td colspan="6"> </td></tr>
<tr class="overskrift_skjema"><td colspan="6"><Field: CustomField_produktgruppe></td></tr>
<tr><td colspan="6"> </td></tr>
<tr><td> </td><td><b>Poser</b></td><td><b>Sjaktel</b></td><td colspan="3"><b>Kilo</b></td></tr>
</If>
<?php
$pose = rawurlencode ("<Field: CustomField_produktnavn> (pose)");
$sjaktel = rawurlencode ("<Field: CustomField_produktnavn> (sjaktel)");
$kilo = rawurlencode ("<Field: CustomField_produktnavn> (kilo)");
?>
<tr><td><Field: CustomField_produktnavn></td><td><input <?php if (!empty($errors[$pose])) { echo "style=\"border: 2px solid red;\" onmouseover=\"return overlib('Ugyldig verdi!');\" onmouseout=\"return nd();\" ";}?>type="text" name="<?=$pose?>" size="2" maxlength="3" value="<?php echo $_POST[$pose]; ?>"> à<Field: CustomField_produktpris_pose></td><td><input <?php if (!empty($errors[$sjaktel])) { echo "style=\"border: 2px solid red;\" onmouseover=\"return overlib('Ugyldig verdi!');\" onmouseout=\"return nd();\" ";}?>type="text" name="<?=$sjaktel?>" size="2" maxlength="3" value="<?php echo $_POST[$sjaktel]; ?>"> à<Field: CustomField_produktpris_sjaktel></td><td><input <?php if (!empty($errors[$kilo])) { echo "style=\"border: 2px solid red;\" onmouseover=\"return overlib('Ugyldig verdi!');\" onmouseout=\"return nd();\" ";}?>type="text" name="<?=$kilo?>" size="2" maxlength="3" value="<?php echo $_POST[$kilo]; ?>"> à<Field: CustomField_produktpris_kilo></td><td><EasyEdit: Edit></td><td><EasyEdit: Delete></td></tr>
You'll notice use of the IsNewValue addon to create gray headers for each product group (yes, it's actually an order form in Norwegian), along with the great Overlib library by Erik Bosrup to present mouseover descriptions of errors in input fields. Each field is repopulated using PHP code (if user typed something and then clicked OK - form validation).
I also spent a lot of time figuring out how to give the input fields a valid "name" attribute, as this is controlled by what my employee puts into the field "product_name". To make sure the name attribute doesn't contain any illegal characters, i use PHP's rawurlencode function.
You can see it in action by visiting http://www.noindexing.please/www.okourt ... oranto.php (replace 'www.noindexing.please' with 'luxor.domeneshop.no'


I think it's yet another example of how everything can be done with Coranto. The whole point of this form is (of course) that the admin can edit, delete and add products and prices from within Coranto, and that the order form will update itself accordingly. If he or she is logged in to Coranto, he/she will even see small "Edit" and "Delete" buttons next to each item, thanks to Parahead's EasyEdit addon.