I have added the onclick event as follows {var value=getElementValue("TexBox4");alert(value)
The element is holding the username and will display. Can you show me any quick code to do this with an external java script and actually pass the variable, so that I can manipulate in the html page. I am getting stuck on passing this username to an html. I am getting much more up to speed with calling functions and such, once I am working with the html and java scripts, but how do I get their from the event on your screen and be able to use the variable.
New to Java script can you help me get started passing var
-
- New User
- Posts: 3
- Joined: Mon Oct 25, 2010 12:53 pm
- First Name: Kathy
- Last Name: Cortez
- Company Name: Sweetwater County
- Phone: 307-872-3954
- Address 1: 80 West Flaming Gorge Way
- City: Green River
- State / Province: Wyoming
- Zip / Postal Code: 82935
- Country: United States
- Contact:
- David
- Profound Logic Staff Member
- Posts: 690
- Joined: Fri Jan 04, 2008 12:11 pm
- First Name: David
- Last Name: Russo
- Company Name: Profound Logic Software
- Contact:
Re: New to Java script can you help me get started passing var
What is the final goal here? It looks like you are trying to pull the user name from the Profound UI screen, right?
After you have it, what do you need to do with it?
After you have it, what do you need to do with it?
-
- New User
- Posts: 3
- Joined: Mon Oct 25, 2010 12:53 pm
- First Name: Kathy
- Last Name: Cortez
- Company Name: Sweetwater County
- Phone: 307-872-3954
- Address 1: 80 West Flaming Gorge Way
- City: Green River
- State / Province: Wyoming
- Zip / Postal Code: 82935
- Country: United States
- Contact:
Re: New to Java script can you help me get started passing var
I was trying to pass the pin which is an (element in texbox4) to my script and then email to the user, defining it as a var in my script. I am experimenting right now with it and emailing a pin to myself generated in my server side script in the external html page. I am not sure if I will be able to use this, as I would have liked to have used PHP, but would still need the PRIPIN variable. So, for now, what would be the most helpful, is if you could elaborate on your example in the getting started guide. Specifically, could you show me how you would apply an external script instead of the inline example, starting at the onclick event open.window("http://somewhere/xxx.html");. Working with the customer number would be a good example and then show an alert of that particular element from the external html or use document.write in the external html . Even just a "Hello this is your customer Numer" example. Just to get me to the process of using the EXTERNAL javascript and simply passing an element. I am not clear on pui.click() api and a short little example of the serverside script and how you would call it to pass "element", would be really helpful. I have attached the 2 page example if you could call it referencing an http doc.html. I think at that point I could figure out the getObj() piece in an external script and your other examples.
- Attachments
-
- ProfoundGettingStartedGuide.pdf
- (56.77 KiB) Downloaded 628 times
- David
- Profound Logic Staff Member
- Posts: 690
- Joined: Fri Jan 04, 2008 12:11 pm
- First Name: David
- Last Name: Russo
- Company Name: Profound Logic Software
- Contact:
Re: New to Java script can you help me get started passing var
To use external JavaScript code, you'll need to define JavaScript functions in such files.
For example, a function to pull a value out of an element on the screen and pass to another page would look like this:
In this example, the function is expecting the id of the desired element to be passed in.
In order to be able to use this function, you just link it into the Profound UI application page.
You can do this by using the "external javascript" property on one of your record formats in Profound UI. There is a file browser that you can use to select the file. The file must be located somewhere inside the /www/profoundui/htdocs folder. It's recommended to put it into /www/profoundui/htdocs/profoundui/userdata/js. You may need to create the folder.
There is no guarantee that the browser will be done loading the file before you try to use it, so you'll probably want to load in the file on the first record format the user comes to when they start the application -- the main menu, if you have one.
Once you have the file loaded in, you can call the function using any event. For example, to call it on a button click, put this code into the button's onclick event:
That will pass the text "TextBox4" into your function. If this is a valid element id on the screen, the function will be able to get the text out of it and pass to your external script.
This can be a PHP script if you want. How to read the query string value in the PHP script is outside the scope of Profound UI, but it can be done very easily through PHP functions -- would reccomend having a look at those.
Once your PHP script has the value, it can do whatever it needs to -- such as sending an email.
For example, a function to pull a value out of an element on the screen and pass to another page would look like this:
Code: Select all
function passValue(elementId) {
var url = "http://somewhere/xxx.php";
// This function returns the "trimmed" text content of an element, given its id.
var text = get(elementId);
// Open URL in new window and pass value on the query string.
url += "?paramName=" + encodeURIComponent(text);
window.open(url, "_blank");
}
In order to be able to use this function, you just link it into the Profound UI application page.
You can do this by using the "external javascript" property on one of your record formats in Profound UI. There is a file browser that you can use to select the file. The file must be located somewhere inside the /www/profoundui/htdocs folder. It's recommended to put it into /www/profoundui/htdocs/profoundui/userdata/js. You may need to create the folder.
There is no guarantee that the browser will be done loading the file before you try to use it, so you'll probably want to load in the file on the first record format the user comes to when they start the application -- the main menu, if you have one.
Once you have the file loaded in, you can call the function using any event. For example, to call it on a button click, put this code into the button's onclick event:
Code: Select all
passValue("TextBox4");
This can be a PHP script if you want. How to read the query string value in the PHP script is outside the scope of Profound UI, but it can be done very easily through PHP functions -- would reccomend having a look at those.
Once your PHP script has the value, it can do whatever it needs to -- such as sending an email.
-
- New User
- Posts: 3
- Joined: Mon Oct 25, 2010 12:53 pm
- First Name: Kathy
- Last Name: Cortez
- Company Name: Sweetwater County
- Phone: 307-872-3954
- Address 1: 80 West Flaming Gorge Way
- City: Green River
- State / Province: Wyoming
- Zip / Postal Code: 82935
- Country: United States
- Contact:
Re: New to Java script can you help me get started passing var
Thanks for the quick reply. This is what I needed. I did not understand the process of linking the external javascript using this property. Good example and will be of great value.
Who is online
Users browsing this forum: No registered users and 4 guests