Append textbox values to URL

rss

Posted by joetel8 - Jan 24 ’17 at 09:51

Hello,

I am seeking assistance on a task to append a text box value to the URL as the field is being added to the textboxes. Example: Amt=Textbox1.value

url+Amt?=[value of Textbox1]

And this value would have to a keyup function.

Any assistance you can provide is greately appreciated.

Thank you,

Joe

 

 

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 2 months 21 days
    #1 by Dmitry Kozlov Jan 25 ’17 at 06:14

    Hi,

    Here is a sample:

    function buildUrl() {
        var url = 'URL?' + fd.field('TextField').value();
        // do something with the url
    }
    
    // on text change
    fd.field('TextField').change(buildUrl);
    
    // on init
    buildUrl();
    

    Replace TextField with the internal name of the field (you can find it in the field's properties in the designer).

  • joetel8
    Member
    Member for: 2 years 10 months 15 days
    #2 by joetel8 Jan 25 ’17 at 03:31

    [#1]:

    Thank you Dmitry,

    This helps me get to my next element.  I am trying to capture the value of the "Amount" field and place it on the URL param so when I open the child "New item" link, I will get the value from the url param and place it on the child form.

    I know how to get the url keyvalue with the "fd.getUrlParam(sourceUrl, 'ParamName')" script, but first I need to place the value in the source URL so I can retrieve it.

    Any assistance you can provide me is greatly appreciated.

    Thank you,

    Joe

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 2 months 21 days
    #3 by Dmitry Kozlov Jan 26 ’17 at 08:36

    [#2]: I see. There is no need to place a parameter into URL to pass it into a child window. If you open a child form in a dialogue, you can retrieve a parent's field value this way:

    window.top.fd.field('FieldName').value()
  • joetel8
    Member
    Member for: 2 years 10 months 15 days
    #4 by joetel8 Jan 26 ’17 at 12:00

    [#3]:

    Thank you Dmitry,

    I know you said I can use this script

    "window.top.fd.field('FieldName').value()"

    and it works well if I open from a NON Dialogue window, but if I am coming from an open dialogue I am getting "undefined".  Is there another script syntax that I can use  to read the fields from an open dialogue.

    Almost there,

    Joe

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 2 months 21 days
    #5 by Dmitry Kozlov Jan 27 ’17 at 03:31

    [#4]: Do you mean that you open both parent and child forms in dialogues?

  • joetel8
    Member
    Member for: 2 years 10 months 15 days
    #6 by joetel8 Jan 27 ’17 at 10:49

    [#5]:

    Yes.

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 2 months 21 days
    #7 by Dmitry Kozlov Jan 30 ’17 at 03:20

    [#6]: Not a good practce, but you can find the parent dialogue in the list of iframes of the parent window:

    window.top.frames[2].fd.field('FieldName').value()

    Test the code with various indices.

     

  • joetel8
    Member
    Member for: 2 years 10 months 15 days
    #8 by joetel8 Jan 30 ’17 at 11:23

    Thank you Dmitry for your assistance.

    I will not open the parent page in a dialog form.  But in order for the form to flow in accordance to our process, is there a way I can redirect the user back to the previous page after submit?

    That way I don't have to open up a dialog box to collect the fields I need.

    Thank you again.

    Joe

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 2 months 21 days
    #9 by Dmitry Kozlov Jan 31 ’17 at 02:52

    [#8]: This is how it works by default. The Source URL parameter contains a URL where a user will be redirected after saving or closing a form.

Displaying 1 to 9 of 9 messages