Hello,
I have a subfile with a search button, when I click on the button I display items matching the search on the subfile. Filling the subfile is a RPG procedure that I call when the Search button is on. At the same time I want to display a javascript code when I click on the Search button, I do it in the onclick property of the button, I put a javascript code like (alert "Info"). At runtime, when I click on the Search button, the javascript code appears (Info) but my RPG procedure is no longer executed.
Javascript
-
- Profound User
- Posts: 37
- Joined: Tue Aug 27, 2013 7:34 am
- First Name: Seynabou
- Last Name: Gueye
- Company Name: Oo2
- Country: Senegal
- Contact:
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Javascript
Yes, that is correct.
A button is not designed to run both the "onclick" and the "response", it should only be one or the other. Doing both on the same button will not work properly and is not supported by Profound Logic.
If you want to do both, then please define a hidden button. Have the "onclick" code of the original button do it's job, and then from that JavaScript code call pui.click("the-hidden-button") to send the response to RPG.
A button is not designed to run both the "onclick" and the "response", it should only be one or the other. Doing both on the same button will not work properly and is not supported by Profound Logic.
If you want to do both, then please define a hidden button. Have the "onclick" code of the original button do it's job, and then from that JavaScript code call pui.click("the-hidden-button") to send the response to RPG.
-
- Profound User
- Posts: 37
- Joined: Tue Aug 27, 2013 7:34 am
- First Name: Seynabou
- Last Name: Gueye
- Company Name: Oo2
- Country: Senegal
- Contact:
Re: Javascript
Scott,
Where do I put the "pui.click"? On the onclick property of the search button?
Where do I put the "pui.click"? On the onclick property of the search button?
-
- New User
- Posts: 7
- Joined: Fri May 24, 2013 10:48 am
- First Name: Amar
- Last Name: Kumar
- Company Name: Alfa Insurance
- Phone: 6153122729
- State / Province: Tennessee
- Country: United States
- Contact:
Re: Javascript
Sharing what worked well for me for doing both the client side edit before sending off the control back to the server.
I attached the submitGaragingAddressChange() function to onClick event of the update button. This way I first do the client side edit and if all good then just pass the control back to the server for the database update.
function submitGaragingAddressChange(){
var status = validateGaragingAddressChange() ;
if(status == "success")
{
pui.click("CssButton_UpdateGaragingAddress",true);
}
};
function validateGaragingAddressChange(status) {
status = "success" ;
if (getElementValue("TextBox_GaragingAddress_Line1") == "")
{
pui.errorTip("TextBox_GaragingAddress_Line1", "Enter the street name") ;
status = "failure";
}
if (getElementValue("TextBox_GaragingAddress_City") == "")
{
pui.errorTip("TextBox_GaragingAddress_City", "Enter the city name") ;
status = "failure";
}
if (getElementValue("ComboBox_GaragingAddress_State") == "")
{
pui.errorTip("ComboBox_GaragingAddress_State", "Select or Enter the State") ;
status = "failure";
}
return status ;
};
I attached the submitGaragingAddressChange() function to onClick event of the update button. This way I first do the client side edit and if all good then just pass the control back to the server for the database update.
function submitGaragingAddressChange(){
var status = validateGaragingAddressChange() ;
if(status == "success")
{
pui.click("CssButton_UpdateGaragingAddress",true);
}
};
function validateGaragingAddressChange(status) {
status = "success" ;
if (getElementValue("TextBox_GaragingAddress_Line1") == "")
{
pui.errorTip("TextBox_GaragingAddress_Line1", "Enter the street name") ;
status = "failure";
}
if (getElementValue("TextBox_GaragingAddress_City") == "")
{
pui.errorTip("TextBox_GaragingAddress_City", "Enter the city name") ;
status = "failure";
}
if (getElementValue("ComboBox_GaragingAddress_State") == "")
{
pui.errorTip("ComboBox_GaragingAddress_State", "Select or Enter the State") ;
status = "failure";
}
return status ;
};
Who is online
Users browsing this forum: No registered users and 8 guests