我嘗試在這里搜索類似的問題,我發現的壁櫥正在使用 Stringify 將物件轉換為字串,然后使用 Parse 再次回傳。(
在 Google 表格中,結果如下:

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.
uj5u.com熱心網友回復:
問題一:
需要發生的事情(不是)首先是支付方式選擇元素的 SelectedINDex 的 .text(而不是值 - 顯示的 .text)。由于某種原因,所選索引的 .value 正在傳遞。我“可以”只是將我想要傳遞的值放入相關的 value="",但我希望這些值保持 1 和 2,而是能夠讀取所選索引的文本。
問題2:
二是購買金額不合格。
修改點:
- 在問題1的情況下,如何準備一個將索引轉換為值的物件?因為,在您的腳本中,顯示值不包含在事件物件中。
- 對于問題 2,您的 HTML
amount用作名稱。所以在這種情況下,需要修改它。
當這些點反映在你的腳本中時,下面的修改怎么樣?
從:
listRecord(e.parameter.description, e.parameter.paymentCard, e.parameter.receiptAmount, url);
到:
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);
筆記:
- 當您修改 Google Apps 腳本時,請將部署修改為新版本。這樣,修改后的腳本就會反映在 Web Apps 中。請注意這一點。
- 您可以在“在不更改新 IDE 的 Web 應用程式 URL 的情況下重新部署 Web 應用程式”的報告中查看詳細資訊。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/453675.html
