I am having difficulties with the following:
My users can add payment accounts (bank, Paypal) to their personal account and select one to be the prefered method of payment.
Once they check out, I retrieve the list of all accounts, assign that to a radio box element (Dynamic Data) and preselect the account of their preference. In order to accomplish this, I set $form->data['account_prefered'] to that account and I have given the radio box element account_prefered for name and ID. So far so good.
When I select an account different from the prefered one, I would expect $form->data['account_prefered'] to be changed to the newly selected account upon submission of the form, since that is the ID of the element and should store the selected radio box.
However, this does not happen. It keeps the value of the originally assigned prefered MOP.
Does anybody have any idea how I can update the value before submission of the form?
My users can add payment accounts (bank, Paypal) to their personal account and select one to be the prefered method of payment.
Once they check out, I retrieve the list of all accounts, assign that to a radio box element (Dynamic Data) and preselect the account of their preference. In order to accomplish this, I set $form->data['account_prefered'] to that account and I have given the radio box element account_prefered for name and ID. So far so good.
When I select an account different from the prefered one, I would expect $form->data['account_prefered'] to be changed to the newly selected account upon submission of the form, since that is the ID of the element and should store the selected radio box.
However, this does not happen. It keeps the value of the originally assigned prefered MOP.
Does anybody have any idea how I can update the value before submission of the form?
Hi MichielStr,
I would expect that to work OK. How do you store the account_preferred data in the database table? Perhaps that isn't linking up correctly.
Bob
I would expect that to work OK. How do you store the account_preferred data in the database table? Perhaps that isn't linking up correctly.
Bob
Hi Bob,
I do not want to update the value in the database. I am offering my users the option to do that in another form.
With the form mentioned I am letting the users chose an account, for just this payment, different from the prefered account set in the database. So if a Paypal account is their prefered account (in the database), I show them that by preselecting the corresponding radio box. If they, however, decide to pay by bank just this one time, they should be able to change the radio box selection to bank and pay by bank just this session. Paypal remains the prefered account in the database.
The variable's value does not change to bank (selected by the user), but keeps the value of the prefered account in the database, initially assigned to the variable...
I do not want to update the value in the database. I am offering my users the option to do that in another form.
With the form mentioned I am letting the users chose an account, for just this payment, different from the prefered account set in the database. So if a Paypal account is their prefered account (in the database), I show them that by preselecting the corresponding radio box. If they, however, decide to pay by bank just this one time, they should be able to change the radio box selection to bank and pay by bank just this session. Paypal remains the prefered account in the database.
The variable's value does not change to bank (selected by the user), but keeps the value of the prefered account in the database, initially assigned to the variable...
Hi MichielStr,
Yes, but I wasn't trying to ask about saving the value. How do you load it into your form to set the drop-down selected value?
Bob
Yes, but I wasn't trying to ask about saving the value. How do you load it into your form to set the drop-down selected value?
Bob
Hi Bob,
I am using a DB Record loader action to get the value.
Anyway, I fixed it. I removed the 'Data to Session' action at the end of the On Load event and the 'Session to Data' one at the start of the On Submit event and instead use hidden inputs to transfer the information I need across the forms and events.
Thanks,
Michiel
I am using a DB Record loader action to get the value.
Anyway, I fixed it. I removed the 'Data to Session' action at the end of the On Load event and the 'Session to Data' one at the start of the On Submit event and instead use hidden inputs to transfer the information I need across the forms and events.
Thanks,
Michiel
This topic is locked and no more replies can be posted.