added new method for sending the server value

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2022-07-22 11:06:39 -05:00
parent 85a2debf4e
commit 16ddcedd80
2 changed files with 7 additions and 1 deletions

View File

@ -23,11 +23,17 @@ public protocol FormFieldProtocol: FormItemProtocol {
/// Returns the value of the field. Used for validations and possibly for sending to server.
func formFieldValue() -> AnyHashable?
/// Returns the value of the field. Used sending to server.
func formFieldServerValue() -> AnyHashable?
}
public extension FormFieldProtocol {
var baseValue: AnyHashable? { nil }
func formFieldServerValue() -> AnyHashable? {
return formFieldValue()
}
}
public class FormFieldValidity{

View File

@ -209,7 +209,7 @@ public extension FormValidator {
var extraParam: [String: Any] = [:]
for (fieldKey, field) in fields {
if let formFieldValue = field.formFieldValue(),
if let formFieldValue = field.formFieldServerValue(),
groupName == field.groupName {
extraParam[fieldKey] = formFieldValue
}