GetValue()
Retrieves the current value of a form input element such as text inputs, textareas, dropdowns, or range sliders.
Syntax
Result = MaterialSB::GetValue(Element)
Parameters
| Element | The form input element to get the value from. |
Return Value
Returns the current value of the element.
Remarks
This function works with elements that have a value property: text inputs, textareas, select dropdowns, and range sliders.
For checkboxes and radio buttons, access the checked property directly via JavaScript instead.
Example
Global nameInput, emailInput, countryDropdown
Procedure SubmitForm()
Protected name.s, email.s, country.s
; Get values from form elements
!v_name = v_nameinput.value;
!v_email = v_emailinput.value;
!v_country = v_countrydropdown.value;
MaterialSB::Toast("Name: " + name + ", Email: " + email + ", Country: " + country)
EndProcedure
Procedure Main(Success)
If Success
MaterialSB::Row(MaterialSB::#Grid_Container)
MaterialSB::Col(12, 6)
MaterialSB::Card()
MaterialSB::CardContent()
MaterialSB::Append(MaterialSB::Header("Registration", 4))
nameInput = MaterialSB::TextInput("Name")
emailInput = MaterialSB::TextInput("Email", "", MaterialSB::#Input_Email)
countryDropdown = MaterialSB::Dropdown("Country")
MaterialSB::DropdownAddOption("Select...", "", countryDropdown, #True)
MaterialSB::DropdownAddOption("USA", "us", countryDropdown)
MaterialSB::DropdownAddOption("UK", "uk", countryDropdown)
MaterialSB::DropdownAddOption("Canada", "ca", countryDropdown)
MaterialSB::Init(countryDropdown, #Null)
MaterialSB::CloseCurrentParent()
MaterialSB::CardAction()
MaterialSB::Button("Submit", @SubmitForm())
MaterialSB::CloseCurrentParent()
MaterialSB::CloseCurrentParent()
MaterialSB::CloseCurrentParent()
MaterialSB::CloseCurrentParent()
EndIf
EndProcedure
MaterialSB::Download(@Main())