javascript to select a textbox on a different section

Comments

8 comments

  • Avatar
    Jason Wells

    Hello,

    This can be done in AgilePoint.

    To help me better understand your concerns, could you lay out what you are trying to achieve in your application? This way I can help guide you in the right direction overall.

    Thanks,

    Jason Wells

    0
    Comment actions Permalink
  • Avatar
    New To Agilepoint User

    Morning Jason.

    I'm capturing data on section 1, called the Input. This captured data is the user's name, age, address etc.

    Once the user clicks on the designated button, this data is compiled into a single string of data which must be listed on the second section, named Records, into a textbox.

    I need the data in the textbox to be a continues list, not overwriting the previous entry with a number the increases for each entry, i.e. 1, 2, 3, at the start of each string entry respectively.

    Example of the string output to appear in the records section:

    1. John Doe // 35 // 362 Black and grey Street // 

    2. Jane Doe // 32 // 4885 Purple Road //

    Any help will be greatly appreciated.

    0
    Comment actions Permalink
  • Avatar
    Jason Wells

    Hello,

    It appears this information is in a repeatable format. Have you tried utilizing the sub form control? 

    Although this solution appears to require some JavaScript, it isn't necessarily required. I created a similar format using a sub-form control which deals with repeatable format and formula controls.

    For example here is the sub-form gathering the information in the Input section. The records field is a formula control that is concatenating it all together into 1 string:

    I then take this information and can apply it to another sub-form in the Records section that is taking the row of each Input record and capturing it for each row. See image below.

    Let me know if this helps!

    Thanks,

    Jason Wells

    0
    Comment actions Permalink
  • Avatar
    New To Agilepoint User

    Good morning, Jason.

    Thank you for the help.

    This could indeed work, however due to specific requirements, I need to have the records appear on another section. 

    Is there javascript code to call a textarea on another section and input data into it?

    I appreciate the help.

    Kind regards

    0
    Comment actions Permalink
  • Avatar
    Jason Wells

    Of course,

    I am trying to understand a bit more.

    In the Input section, are users inputting data into a number of textboxes or is it a sub-form? 

    For example, is it 3+ textboxes then compiling into 1 text area, etc.?

     

    Thanks.

    Jason Wells

    0
    Comment actions Permalink
  • Avatar
    New To Agilepoint User

    Hi Jason.

    The input data comes from the original section. Here the data is typed into several textboxes. No sub-forms are used.

    From there the data needs to be transferred to the next section, named Records.

    I hope this helps.

    Regards

    0
    Comment actions Permalink
  • Avatar
    Jason Wells

    Hello,

    Thanks for getting back to me!

    Yes, it can be done. My solution above is just the approach that we take because AgilePoint as the codeless architecture framework allows for it to all be done without coding. 

    The code below isn't a perfect solution because of input error, you may need you to restarted the form entries, that is why I suggested the sub-form approach. Here is the JavaScript:

    function concatDataStrings() {
        let rowNumber;
        let name;
        let age;
        let address;
        let textArea;

        eFormHelper.getFieldValue({ fieldId: 'Name' }, function(r) {
            name = r.data;

            eFormHelper.getFieldValue({ fieldId: 'Age' }, function(res) {
                age = res.data;

                eFormHelper.getFieldValue({ fieldId: 'Address' }, function(res2) {
                    address = res2.data;

                    eFormHelper.getFieldValue({ fieldId: 'HiddenRowNumber' }, function(res3) {
                        rowNumber = res3.data;

                        eFormHelper.getFieldValue({ fieldId: 'TextArea1' }, function(res4) {
                            if(res4.data == '') {
                                textArea = rowNumber + ' // ' + name + ' // ' + age + ' // ' + address;
                            } else {
                                textArea = res4.data + '\r\n' + rowNumber + ' // ' + name + ' // ' + age + ' // ' + address;
                            }

                            rowNumber++;

                            eFormHelper.setFieldValue({ fieldId: 'TextArea1', value: textArea }, function(res5) { console.log(res5); });
                            eFormHelper.setFieldValue({ fieldId: 'HiddenRowNumber', value: rowNumber }, function(res6) { console.log(res6); });
                        });
                    });
                });
            });
        });
    }

    You'll have to add a hidden number box control to track the count of the list. that is what you see in the code above. Make sure this number box control default value is 1.

    Here is the configuration to add to the button control to initiate this:

    And here is the output, in this example it is on the same section to show both in 1 screenshot.

    Thanks,

    Jason Wells

    0
    Comment actions Permalink
  • Avatar
    New To Agilepoint User

    Afternoon Jason.

     

    Thank you for the help.

    I'll give it a try.

    Thanks

     

     

    0
    Comment actions Permalink

Please sign in to leave a comment.