Home > database >  SelectionInput forms using Google Cards RPC API
SelectionInput forms using Google Cards RPC API

Time:02-04

I'm building a Workspace add-on using the JSON Card API (i.e. not via Apps Script. I couldn't find a SO tag for this): https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1 .

Forms elements are declared with the SelectionInput object :

https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1?hl=en#selectioninput

I want the form to be sent only by clicking on a "Send" button.

How is form submission handled when onChangeAction is not specified ? I see "If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button.", but what if the Card has more than one button ? The documentation and the API don't seem to account for this.

CodePudding user response:

The answer seems to be : all button clicks implicitly send all form data inside the commonEventObject.formInputs field of the JSON request body.

For instance, if we have a form named form_test with radio buttons having values 1, 2, 3 and select the first one, formInputs will be :

{"form_test":{"stringInputs":{"value":["1"]}}} 

Thank you Google for not documenting the semantics of your APIs!

  •  Tags:  
  • Related