Workflow Soluiton

 View Only
  • 1.  Dynamic update textbox

    Posted Mar 16, 2016 06:01 AM

    I have a dropdown, items selected in the dropdown i need the same text to be in be displayed in the textbox below. I used dynamic model for initial value of text box but it failed. 

    Capture1.PNG

    Capture2.PNG



  • 2.  RE: Dynamic update textbox

    Posted Mar 16, 2016 10:40 AM

    if you want to use a dynamic panel in this manner, elements that you'd like to affect one another need to reside within the same dynamic panel.  try placing the dropdown in the panel and test again, and let me know if you experience different results.



  • 3.  RE: Dynamic update textbox

    Posted Mar 17, 2016 01:14 AM

    Africo, I tried that also but could not get as expected.



  • 4.  RE: Dynamic update textbox

    Posted Mar 17, 2016 07:42 AM

    You could do a post form on value change then set the value of the textbox to the Output Data of the combo



  • 5.  RE: Dynamic update textbox
    Best Answer

    Posted Mar 17, 2016 12:26 PM
      |   view attached

    hi Kiran - you could also skip all that and just use javascript; using js will allow you to control the values on your form without necessarily needing to refresh the page to do so.

    i've attached a very simple project to demonstrate.

    here's a quick instruction on how to do it:

    2016-03-17_10-13-52.png

    Give the dropdown a unique control id:

    2016-03-17_10-15-51.png

    and give the textbox you want to affect a unique control id:

    2016-03-17_10-16-59.png

    then, right-click anywhere in an empty space on the form (or double-click) and click Edit Form.

    2016-03-17_10-17-54.png

    go to the Behavior tab and add a new AttributesKeyValuePair.

    2016-03-17_10-19-12.png

    IMPORTANT!

    if you copy/paste from the code snippets below, paste the text first into notepad, and then copy from notepad into the workflow text creator.  this will strip the formatting and ensure no errors occur when the workflow and browser attempt to parse the script.

    Event: onload

    Event handler:

    var t1 = document.getElementById('testvalue1');
    var t2 = document.getElementById('testvalue2');
    
    t1.setAttribute('oninput','checkDrop()');
    t1.setAttribute('onchange','checkDrop()');
    
    checkDrop();

    2016-03-17_10-20-55.png

    Back on the Behavior tab, at the bottom, is the Script section.  Enter this code into the script section:

    function checkDrop() {
    var t1 = document.getElementById('testvalue1');
    var t2 = document.getElementById('testvalue2');
    
    t2.value = t1.options[t1.selectedIndex].text;
    } 

    Note that we are building a function in the Script section called "checkDrop" that is called on page load (we've attached the function call to the "onchange" and "oninput" events of the dropdown in the event handler, above).

    This should work the way you indicated.

    While this method probably seems complicated if you're unacquainted with javascript, once you've figured out how to include javascript actions in your workflow pages, a nice new world of UI functionality and user experience opens up.

    Do reply and let me know how it goes.

    -andrew

    Attachment(s)



  • 6.  RE: Dynamic update textbox

    Posted Mar 18, 2016 01:38 AM

    Awesome Africo, Great Job!!!. Thanks and appreciated for the effort and time spent for this.



  • 7.  RE: Dynamic update textbox

    Posted Mar 18, 2016 01:41 AM

    Glad to help!