[TYPO3-shop] Problems when form is submitted by javascript

Joachim Rosskopf rosskopf at progroup-inc.com
Wed Sep 13 09:54:16 CEST 2006


Hello Franz,

thank you for the advice. I did like you said:
<snip>
<script tpye="text/javascript">
function checkAgb() {
         var box  = document.getElementById("agbSelected");
         var form = document.getElementById("mainForm");
         if (box == null || form == null) {
                 alert("Can´t find checkbox or form!");
                 return false;
         }
         if (box.checked) {
                 form.action='###FORM_URL_THANKS###';
                 form.target='###FORM_URL_TARGET###';
                 form.submit();

                 return true;
         } else {
                 alert("Achtung: Bevor die Bestellung ....");
                 return false;
         }
}
</script>
</snip>

But the result is still the same: I get redirected to the "OVERVIEW" or 
better the "products_overview"-activity. That is happening around the 
if/ifelse statements in the products_basket function, I think.

I don´t know what else to do?
Thank you in advance!
---
Joachim


Franz Holzinger wrote:
> Hello Joachim,
> 
> 
>> <input type="Submit" name="products_update" value="Zurück zum 
>> Warenkorb">&nbsp;&nbsp;   <input type="Button" 
>> name="products_finalize" value="Bestellvorgang abschliessen!" 
>> onClick="checkAgb();">
>>
> 
> there is missing the return in the onClick parameter:
> 
> return false; if an error has occured
> 
> return true; if everything went fine
> 
> document.forms[0] will work only if there is no other form on the page.
> The function document.getElementById should be used also here.
> 
> 
> Greets,
> 
> Franz



More information about the TYPO3-project-tt-products mailing list