Page 1 of 1
Append textbox values to URL
Posted: 24 Jan 2017
by joetel8
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
Re: Append textbox values to URL
Posted: 25 Jan 2017
by Dmitry Kozlov
Hi,
Here is a sample:
Code: Select all
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).
Re: Append textbox values to URL
Posted: 25 Jan 2017
by joetel8
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
Re: Append textbox values to URL
Posted: 26 Jan 2017
by Dmitry Kozlov
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:
Code: Select all
window.top.fd.field('FieldName').value()
Re: Append textbox values to URL
Posted: 26 Jan 2017
by joetel8
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
Re: Append textbox values to URL
Posted: 27 Jan 2017
by Dmitry Kozlov
Do you mean that you open both parent and child forms in dialogues?
Re: Append textbox values to URL
Posted: 27 Jan 2017
by joetel8
Yes.
Re: Append textbox values to URL
Posted: 30 Jan 2017
by Dmitry Kozlov
Not a good practce, but you can find the parent dialogue in the list of iframes of the parent window:
Code: Select all
window.top.frames[2].fd.field('FieldName').value()
Test the code with various indices.
Re: Append textbox values to URL
Posted: 30 Jan 2017
by joetel8
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
Re: Append textbox values to URL
Posted: 31 Jan 2017
by Dmitry Kozlov
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.