Index: fpdfsdk/src/javascript/Field.cpp |
diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp |
index 959e8dcadd560a8052c387aea1a08880ae97bf06..d97001aae2690a10868002dbbcb145b9ef13140f 100644 |
--- a/fpdfsdk/src/javascript/Field.cpp |
+++ b/fpdfsdk/src/javascript/Field.cpp |
@@ -2738,19 +2738,7 @@ FX_BOOL Field::value(IJS_Context* cc, |
return FALSE; |
case FIELDTYPE_COMBOBOX: |
case FIELDTYPE_TEXTFIELD: { |
- CFX_WideString swValue = pFormField->GetValue(); |
- |
- double dRet; |
- FX_BOOL bDot; |
- if (CJS_PublicMethods::ConvertStringToNumber(swValue.c_str(), dRet, |
- bDot)) { |
- if (bDot) |
- vp << dRet; |
- else |
- vp << dRet; |
- } else { |
- vp << swValue; |
- } |
+ vp << pFormField->GetValue(); |
} break; |
case FIELDTYPE_LISTBOX: { |
if (pFormField->CountSelectedItems() > 1) { |
@@ -2766,40 +2754,18 @@ FX_BOOL Field::value(IJS_Context* cc, |
} |
vp << ValueArray; |
} else { |
- CFX_WideString swValue = pFormField->GetValue(); |
- |
- double dRet; |
- FX_BOOL bDot; |
- if (CJS_PublicMethods::ConvertStringToNumber(swValue.c_str(), dRet, |
- bDot)) { |
- if (bDot) |
- vp << dRet; |
- else |
- vp << dRet; |
- } else { |
- vp << swValue; |
- } |
+ vp << pFormField->GetValue(); |
} |
} break; |
case FIELDTYPE_CHECKBOX: |
case FIELDTYPE_RADIOBUTTON: { |
- FX_BOOL bFind = FALSE; |
+ bool bFind = false; |
for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) { |
- if (!pFormField->GetControl(i)->IsChecked()) |
- continue; |
- |
- CFX_WideString swValue = pFormField->GetControl(i)->GetExportValue(); |
- double dRet; |
- FX_BOOL bDotDummy; |
- if (CJS_PublicMethods::ConvertStringToNumber(swValue.c_str(), dRet, |
- bDotDummy)) { |
- vp << dRet; |
- } else { |
- vp << swValue; |
+ if (pFormField->GetControl(i)->IsChecked()) { |
+ vp << pFormField->GetControl(i)->GetExportValue(); |
+ bFind = true; |
+ break; |
} |
- |
- bFind = TRUE; |
- break; |
} |
if (!bFind) |
vp << L"Off"; |
@@ -2809,7 +2775,7 @@ FX_BOOL Field::value(IJS_Context* cc, |
break; |
} |
} |
- |
+ vp.MaybeCoerceToNumber(); |
return TRUE; |
} |