1494 views

Description

The onSubmit client script on sc_cart is not called the second time.

Steps to Reproduce

 

  1. Enable two step checkout model (glide.sc.checkout.twostep).
  2. Go to Maintain Cart Layouts > Cart Preview Screen (Two step).
  3. Enable all columns, buttons, and components,except for Shipping location.
  4. Create the following client script:

    Table: sc_cart
    UI Type: Desktop
    Type: onSubmit
    Global: true
    Script:
    function onSubmit() {
    var authMgr = gel('sc_cart.requested_for').value;
    jslog('***DEBUG: authMgr = ' + authMgr);
    if (authMgr == '') {
    alert('Authorizing Manager is a required field. Please select a value before continuing.');
    return false;
    } else {
    jslog("***DEBUG: WJH - Push Cart Values to Hints: else");
    }
    }

  5. Order an iPad 3. On the checkout page (servicecatalog_checkout_one_v2), remove your name from the Requested For field.
    The following error occurs on the console:

    ERROR: invalid field ('requested_for') passed to g_form.hideFieldMsg
    NOTE: This error happens even without the client script.

  6. With Requested For empty, click Checkout.
    You receive an alert complaining that the field is empty and the submission is aborted.
  7. Click OK to close the alert.
  8. Click Checkout again.
    Nothing happens (with and without Requested For filled out).

Workaround

This issue is fixed in the Helsinki release. If you are unable to upgrade, use the following workaround.

Change the client script. If you do not add a client script to check if Requested For is empty (or make any other field mandatory), then the checkout flow is not affected. If a client script has to be added, it has to re-set a boolean variable checkoutSubmitted (which is true when checkout has been clicked the first time) to false, so that checkout can be reset and becomes available again.

Table: sc_cart 
UI Type: Desktop 
Type: onLoad 
Global: true 
Sample Script: (Add the line in bold before returning)

function onSubmit() {
var authMgr = gel('sc_cart.requested_for').value;
jslog('***DEBUG: authMgr = ' + authMgr);
if (authMgr == '') {
alert('Authorizing Manager is a required field. Please select a value before continuing.');

checkoutSubmitted = false;
return false;
} else {
jslog("***DEBUG: WJH - Push Cart Values to Hints: else");
}
}


Related Problem: PRB643188

Seen In

Helsinki Patch 1

Fixed In

Helsinki

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2016-08-01 08:52:22
Published:2015-10-16