Want to take typed value on navigate to a pop_up editor

Want to take typed value on navigate to a pop_up editor

  
Hi Everyone, 
                      I have a Edit screen which has some auto-complete input fields, Now I want to take these selected values to the preparation action on the popup editor on a button click on this screen . I tried  WidgetName.TypedValue, but it is not working. It works if method is submit(not with navigate) but then popup editor doesn't work . TypedValue propery is defined as "The value typed by the end user in the widget when form was submitted." , So I think it is behaving as expected. How can behavior be acheived ? Do I need to use onchange action to set some local variable and then send it ?

PS:  I tried to use onchange action of input widget and in the action I tried to use ajax refresh on the input widget but It didn't work. Then I tried to use ajax refresh on the parent edit record widget and It started getting new typed value for the child input widget. What is making it behave this way ? 

Regards
Hi,

I see an easy options here. By the way you should try to use the screen variables instead of the typedvalue. Typedvalue is more for validation logic.

Have 2 buttons. 1 ajax and 1 navigate with a display:none style. Associate the hidden button with the popup. Make sure the button and the popup editor are inside a container and that the container has a name. The popup screen should recieve what you need to pass as input parameters. This way in the action of the ajax button you can refresh the container around the navigate button and do a WidgetClick to open the popup.

I can think of some more alternatives that don't include a server roundtrip. But it would require changing the link of the button with javascript. Probably not worth it unless you feel a big delay between the clicking and popup openning. I've seen this done with links, not  100% sure it can be applied to buttons.

Regards,
João Rosado
"By the way you should try to use the screen variables instead of the typedvalue. "

Can typed values be accessed using screeen variables before saving the screen record ? If yes, then how ? Is there any way to access the auto-complete selected value using javascript ? Thanks.

PS: BTW the workaround that you provided worked. Thanks.

Regards

Hi,

Variables can be accessed in any Submit or Ajax screen action. Doesn't need to be a "Save" action.

Accessing the "typed value" of a input is easy. Something like "$('#" + inputname.Id + "').val()"
Accessing the internal "id" filled by the autocomplete is harder ..but nothing impossible with some digging (note that this can easily break if the implementation of the autocomplete changes). Something like "$('#" + autocompleteblockname.Id + "').find('input').first().val()"

Regards,
João Rosado
Hi Joao, 
             If you look at the dom, the first(or second) input after the autocomplete doesn't have value. I tried using "$('#" + autocompleteblockname.Id + "').find('input').first().val()" in an alert but couldn't as its getting an error that could  not complete the operation due to error 80020101 which seems to be an ajax issue. I am not too concerned about it at this time as the workaround works but would like to learn it doing the proper way. Thanks.

Regards
Hi,

I recomend would keep the inicial solution I sugested unless it has noticable performance problems. It's not a bad solution.
The javascript solution is a bit more dangerous because it assumes internal implementation of both the popup editor and the auto complete, it could break in the future if the implementation changes.

Anyway did you just try to run it in a alert like that? I wrote it in a Service Studio expression format where autocompleteblockname.Id part needs o be replaced if you want to run directly in the browser.

Regards,
João Rosado

Hi Joao, 
              I understand where you are coming from in terms of implementation part. I changed the autocompleteblockname part with the name of autocompleter widget and it was getting the correct dynamic id but after looking at page source I couldn't find any value in input fields after that element. 

Regards
What autocomplete are you using? I was assuming the one from RichWidgets.

I should have asked :)
yes, one from richwidgets. 
To continue on this matter, I do have performance issue with the server roundtrip. so how to fix it directly without a server roundtrip ?