cancel
Showing results for 
Search instead for 
Did you mean: 

How to set default value into alfresco/forms/SingleTextFieldForm

janaka1984
Star Contributor
Star Contributor

Hi,

How to set default value into 'alfresco/forms/SingleTextFieldForm' , when load browser.

Regards

janaka

4 REPLIES 4

ddraper
World-Class Innovator
World-Class Innovator

It extends form so you just need to set a "value" attribute, the key of the value needs to match the textFieldName attribute, an example would be like this:

{
  name: "alfresco/forms/SingleTextFieldForm",
  config: {
    useHash: false,
    okButtonLabel: "Search",
    okButtonPublishTopic: "TEST_PUBLISH",
    textFieldName: "search",
    value: {
      search: "initialValue"
    }
  }‍‍‍‍‍‍‍‍‍‍‍
}


Note that "textFieldname" is "search" which is a key in the "value".

i need to set preference value into "SingleTextFieldForm", unless URL provide parameter 

if URL provide parameter , it should apply into "SingleTextFieldForm". To do this, i need to set useHash to be true. but then

default value is not applied. 

(http://127.0.0.1:8080/share/page/site/advance-search/dp/ws/faceted-search#searchTerm=java&scope=rep... )

ddraper
World-Class Innovator
World-Class Innovator

I think in that case you have 3 options...

  1. Extend and customise the SingleTextFieldForm widget
  2. Make a pull request for the SingleTextFieldForm
  3. Raise a feature request on GitHub - but as this is a feature request rather than a bug then there is no guarantee when I will be able to get to it to implement it.

thanks

i will try one of this