Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     SOLVED]javascript alert

Read-Only Read-Only Topic
Go
Search
Notify
Tools
SOLVED]javascript alert
 Login/Join
 
Guru
posted
I am trying to add javascript to my submit button. If the user doesn't enter in selection criteria. It is suppose to give them an alert and not execute the submit. I get it to show the alarm, but it executes the submit. What am I missing?

  

//Begin function form1Submit_onclick
function form1Submit_onclick(ctrl) {
	e1 = document.getElementById("edit1");
	c1 = document.getElementById("combobox1");

	if (c1.value == '' && e1.value == ''){

		alert("Please enter in a value for a Product or a NDC!");
		return false;
   }else {
   	return true;
   }
   document.form1.submit();

}
//End function form1Submit_onclick


This message has been edited. Last edited by: Jay Potter,


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Report This Post
Expert
posted Hide Post
Jay,

The form will submit because your document.form1.submit(); statement is outside the if statement. If you put it right after the else - I'm not sure what the return true; does, try replacing that with the submit statement.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Guru
posted Hide Post
This is what I changed it to and it is still submitting.

 

//Begin function form1Submit_onclick
function form1Submit_onclick(ctrl) {
	e1 = document.getElementById("edit1");
	c1 = document.getElementById("combobox1");

	if (c1.value == '' && e1.value == ''){

		alert("Please enter in a value for a Product or a NDC!");
		return false;
   }else {
		document.form1.submit();
   }


}
//End function form1Submit_onclick
 


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Report This Post
Virtuoso
posted Hide Post
Check this thread out:
http://stackoverflow.com/quest...from-being-submitted


8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.
 
Posts: 1113 | Location: USA | Registered: January 27, 2015Report This Post
Guru
posted Hide Post
Thank You for your suggestions. I had tried all those things before and they didn't work. So I rebuilt the form from scratch and I got it to work. I think there was a problem with the way the form was modified multiple times.

Thanks again


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Report This Post
Expert
posted Hide Post
One thing you need to be aware of, is if the button is a submit button or not.

If it is, then the onclick needs to return a false/true, if it isn't then Jays, code will work.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Gold member
posted Hide Post
Hi Jay

Create a new button and remove the value and add the IBI_btn-run to the class identifier. This will make the button look like the submit btn and then hide the original submit button.

If in App Studio then in the code for the new button use: IbComposer_triggerExecution(taskName, whichRequest) or in DevStudio use IbComposer_execute or just programmatically trigger the onclick event for the old submit button.

Thanks Barry


WebFOCUS 8103, Windows, App Studio
 
Posts: 80 | Location: NYC | Registered: November 13, 2008Report This Post
Guru
posted Hide Post
Thank you for the information. I recreated the form from scratch and I is working for me.


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     SOLVED]javascript alert

Copyright © 1996-2020 Information Builders