WebView.SetFormValue
--------------------

Set the value of the specified Field in a WebViewer.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [WebView](component_WebView.md) | [1.3](newinversion13.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ✅ Yes |

MBS( "WebView.SetFormValue"; WebViewerRef; FormNameOrIndex; Field; NewValue { ; OnlyVisible } ) 

**MBS**( **"WebView.SetFormValue";** /\* Set the value of the specified Field in a WebViewer. \*/  
**$WebViewerRef**; /\* Either the Web Viewer Object Name or the Web Viewer ID as returned by "[WebView.FindByName](WebViewFindByName.md)" function. \*/   
**$FormNameOrIndex**; /\* Either the Name of the Form or the Index starting at 0 \*/   
**$Field**; /\* the name of the field, case sensitive \*/   
**$NewValue**; /\* the value to set \*/   
**$OnlyVisible**) /\* Optional; Whether to look for all fields or only the visible ones. Default is false.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| WebViewerRef | Either the Web Viewer Object Name or the Web Viewer ID as returned by "[WebView.FindByName](WebViewFindByName.md)" function. |  |  |
| FormNameOrIndex | Either the Name of the Form or the Index starting at 0 |  |  |
| Field | the name of the field, case sensitive |  |  |
| NewValue | the value to set |  |  |
| OnlyVisible | Whether to look for all fields or only the visible ones. Default is false. | 0 | Optional |

### Description

Set the value of the specified Field in a WebViewer.  
To learn about forms and fields on a website, you can use the Form Utility application included with our plugin.  
  
Some websites use a lot of JavaScript, so you may need to send change event to control via [WebView.RunJavaScript](WebViewRunJavaScript.md) so the javascript is notified about the changes.  
### Examples

Set A form value

 Let(  
\[  
  
Field = "name";  
NewValue = "Clark Kent";  
Form = "myForm";  
WebViewerName = "MyWebViewer";  
  
WindowRef = MBS ("[Window.FindByTitle](WindowFindByTitle.md)"; Get(WindowName));  
WebViewerID = MBS ("[WebView.FindByName](WebViewFindByName.md)"; WindowRef; WebViewerName)  
  
\];  
  
  
MBS ("WebView.SetFormValue"; WebViewerID; Form; Field; NewValue)  
  
)  
Fill a form:

 MBS ( "WebView.SetFormValue" ; "web"; "search"; "street\_name"; "test2" )  
### See also

- [WebView.FindByName](WebViewFindByName.md)
- [WebView.GetFormValue](WebViewGetFormValue.md)
- [WebView.RunJavaScript](WebViewRunJavaScript.md)
- [WebView.SetFormInputValue](WebViewSetFormInputValue.md)
- [Window.FindByTitle](WindowFindByTitle.md)

### Example Databases

- [WebViewer/Disable Javascript alerts on Webviewer Mac](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WebViewer/Disable%20Javascript%20alerts%20on%20Webviewer%20Mac.shtml#1ScriptAnchor_)
- [WebViewer/Form Fields/Benchmark](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WebViewer/Form%20Fields/Benchmark.shtml#1ScriptAnchor_)
- [WebViewer/Form Fields/Forms Sample](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WebViewer/Form%20Fields/Forms%20Sample.shtml#1295FieldAnchor_)
- [WebViewer/Form Fields/WebViewer Forms](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WebViewer/Form%20Fields/WebViewer%20Forms.shtml#1295FieldAnchor_)

### Blog Entries

- [Automate web viewer in FileMaker](https://www.mbsplugins.de/archive/2020-01-20/Automate_web_viewer_in_FileMak/monkeybreadsoftware_blog_filemaker)

Created 18th August 2014 , last changed 4th November 2021

  
[WebView.SetFormTextAreaValue](WebViewSetFormTextAreaValue.md) - [WebView.SetFrameWithControl](WebViewSetFrameWithControl.md)

[HTML Version](WebViewSetFormValue.shtml)