Willow affordance setValueTo etc

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Willow affordance setValueTo etc

eftomi
Dear all,

I'm playing with Willow and found it very useful for setting the web design, however, I have some challenges with understanding the interaction affordances. They are nicely described in the documentation - although somewhat cryptic. For instance, I cannot successfully set up the #setValueTo:thenTriggerChangeOf: "directly" on the TextField like in this example, where I'd like to set the text of aText to 'Some other text' after the button aButton is clicked: 

renderContentOn: html
    | aText aButton |
    aText := self componentSupplier
        singleLineTextFieldApplying: [ :theField | ].

    aText changeContentsTo: 'Some text'. 
   
    aButton := self componentSupplier
        asynchronicButtonLabeled: 'Click me' applying: [ :theButton |  ].
   
    aButton onTrigger setValueTo: 'Some other text' thenTriggerChangeOf: aText.

The web browser reports 500 Internal server error with The identifier was never assigned. 

It is mentioned in the docs that IdentifiedWebView should be used to guarantee the id, however I cannot get it to work. 

As I understand, #serialize; #setValueTo: can be used instead of #serialize; #evaluate: ; #render affordances to get the data from the browser, inspect it and sending it back to the browser - or should #determineBehaviorByEvaluating always be used for that purpose?

Thanks,
Tomaz
Reply | Threaded
Open this post in threaded view
|

Re: Willow affordance setValueTo etc

gcotelli
Hi Tomaz,
Just from my memory try:
renderContentOn: html
    | aText aButton |
    aText := self componentSupplier
        singleLineTextFieldApplying: [ :theField | ].

    aText identifyIn: html;
              changeContentsTo: 'Some text'. 
   
    aButton := self componentSupplier
        asynchronicButtonLabeled: 'Click me' applying: [ :theButton |  ].
   
    aButton onTrigger setValueTo: 'Some other text' thenTriggerChangeOf: aText.

We're trying to self-identify components when needed, so you can raise an issue on the issue tracker and we can see if this case can be automatically handled.


On Sun, May 17, 2020 at 6:42 AM Tomaž Turk <[hidden email]> wrote:
Dear all,

I'm playing with Willow and found it very useful for setting the web design, however, I have some challenges with understanding the interaction affordances. They are nicely described in the documentation - although somewhat cryptic. For instance, I cannot successfully set up the #setValueTo:thenTriggerChangeOf: "directly" on the TextField like in this example, where I'd like to set the text of aText to 'Some other text' after the button aButton is clicked: 

renderContentOn: html
    | aText aButton |
    aText := self componentSupplier
        singleLineTextFieldApplying: [ :theField | ].

    aText changeContentsTo: 'Some text'. 
   
    aButton := self componentSupplier
        asynchronicButtonLabeled: 'Click me' applying: [ :theButton |  ].
   
    aButton onTrigger setValueTo: 'Some other text' thenTriggerChangeOf: aText.

The web browser reports 500 Internal server error with The identifier was never assigned. 

It is mentioned in the docs that IdentifiedWebView should be used to guarantee the id, however I cannot get it to work. 

As I understand, #serialize; #setValueTo: can be used instead of #serialize; #evaluate: ; #render affordances to get the data from the browser, inspect it and sending it back to the browser - or should #determineBehaviorByEvaluating always be used for that purpose?

Thanks,
Tomaz
Reply | Threaded
Open this post in threaded view
|

Re: Willow affordance setValueTo etc

eftomi
    aText identifyIn: html;
              changeContentsTo: 'Some text'. 
   

Great, it works, thanks.

Best wishes,
Tomaz