I've tried searching for a similar problem on here, and the closet I found was converting object to strings using Stringify and back again using Parse. (
And in Google Sheets, ends up like this:
What needs to happen (that isn't), is first, the SelectedINdex's .text for the Payment Method Select Element (not the value -the displayed .text). For some reason the .value of the selected Index is passing instead. I "COULD" just put the value I want passing, into thee relevant value="", but I wish the values to remain 1 an 2, and instead be able to read the selected index's text.
Second, the Amount of purchase isn't passing.
Can anyone advise?
Is it possible to Add PaymentCard and PurchaseAmount to the list of parameters as i'm trying to do in the Script Code :
listRecord(e.parameter.description, e.parameter.paymentCard, e.parameter.receiptAmount, url);
It SHOULD have looked like this if correctly working...
thank you all for your patience and support.
CodePudding user response:
Question 1:
What needs to happen (that isn't), is first, the SelectedINdex's .text for the Payment Method Select Element (not the value -the displayed .text). For some reason the .value of the selected Index is passing instead. I "COULD" just put the value I want passing, into thee relevant value="", but I wish the values to remain 1 an 2, and instead be able to read the selected index's text.
Question 2:
Second, the Amount of purchase isn't passing.
Modification points:
- In the case of question 1, how about preparing an object for converting the index to the value? Because, in your script, the display value is not included in the event object.
- In the case of question 2, your HTML uses
amount
as the name. So in this case, it is required to modify this.
When these points are reflected in your script, how about the following modification?
From:
listRecord(e.parameter.description, e.parameter.paymentCard, e.parameter.receiptAmount, url);
To:
var obj = {"1": "Business Debit Card Ending 1111", "2": "Personal Credit Card Ending 2222"};
listRecord(e.parameter.description, obj[e.parameter.paymentCard] || "", e.parameter.amount, url);
Note:
- When you modified the Google Apps Script, please modify the deployment as a new version. By this, the modified script is reflected in Web Apps. Please be careful this.
- You can see the detail of this in the report of "Redeploying Web Apps without Changing URL of Web Apps for new IDE".