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     [CLOSED] Dev Studio GUI Newbie Question: Where to add form validation?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Dev Studio GUI Newbie Question: Where to add form validation?
 Login/Join
 
Expert
posted
The Dev Studio v7.6.8 HTML Composer tool generated this form tag code:

<FORM id=form2 style="Z-INDEX: 2; LEFT: 0px; WIDTH: 901px; POSITION: absolute; TOP: 0px; HEIGHT: 538px" tabIndex=2 name=form2 onsubmit="OnExecute(this);return false;" method=post fexlist_list="form2" form_dist_between_desc_and_input="10" form_hor_dist_between_controls="10" vert_dist_between_controls="10" form_number_of_columns="4" form_number_of_visible_rows="4" form_prompt_location="1" default_slider_type="4" requests_list="0" autoExecute="True">

The submit button code:

<INPUT id=form2Submit style="FONT-WEIGHT: normal; FONT-SIZE: 10pt; Z-INDEX: 20; LEFT: 680px; BACKGROUND-IMAGE: none; VERTICAL-ALIGN: middle; WIDTH: 80px; COLOR: black; FONT-STYLE: normal; FONT-FAMILY: Arial; POSITION: absolute; TOP: 140px; HEIGHT: 22px; BACKGROUND-COLOR: gainsboro" tabIndex=20 type=submit value=View name=ITEM1>

Where do I stick JavaScript code to validate form objects and not break the GUI?

Thanks,

This message has been edited. Last edited by: Francis Mariani,


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
You need to write the Customized Javascript coding inside the <script> tag, generated by composer.

Just as a basic example

For eg:

 function validateInputs()
{
 var txval =  document.getElementById('text1').value;
 if( txval.trim() == '')
    alert('Hi Francis, Please Enter Field');
 else
    alert('Hi Francis, You have Entered : ' + txval);
} 


This is the JS function you can call for validating a Text box.

 <HTML>
<HEAD>
<FORM id=form2 style="Z-INDEX: 2; LEFT: 0px; WIDTH: 901px; POSITION: absolute; TOP: 0px; HEIGHT: 538px" tabIndex=2 name=form2 onsubmit="OnExecute(this);return false;" method=post autoExecute="True" requests_list="0" default_slider_type="4" form_prompt_location="1" form_number_of_visible_rows="4" form_number_of_columns="4" vert_dist_between_controls="10" form_hor_dist_between_controls="10" form_dist_between_desc_and_input="10" fexlist_list="form2">
<META content="MSHTML 6.00.6000.17093" name=GENERATOR>
<SCRIPT id=clientEventHandlersJS type=text/javascript>
function window_onload() {
UpdateData();
// TODO: Add your event handler code here
}
function validateInputs()
{
 var txval = document.getElementById('text1').value;
 if( txval.trim() == '')
	alert('Hi Francis, Please Enter Field');
 else
	alert('Hi Francis, You have Entered : ' + txval);
}
</SCRIPT>

<SCRIPT for=window eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
</HEAD>
<BODY style="OVERFLOW: auto">
<INPUT id=text1 style="Z-INDEX: 21; LEFT: 240px; WIDTH: 190px; POSITION: absolute; TOP: 80px" tabIndex=21 name=edit1> 
<SPAN id=text1 style="Z-INDEX: 22; LEFT: 140px; WIDTH: 90px; POSITION: absolute; TOP: 80px; HEIGHT: 20px" tabIndex=22>Enter Field : 
</SPAN>
<INPUT id=form2Submit style="FONT-WEIGHT: normal; FONT-SIZE: 10pt; Z-INDEX: 20; LEFT: 200px; BACKGROUND-IMAGE: none; VERTICAL-ALIGN: middle; WIDTH: 80px; COLOR: black; FONT-STYLE: normal; FONT-FAMILY: Arial; POSITION: absolute; TOP: 130px; HEIGHT: 22px; BACKGROUND-COLOR: gainsboro" onclick=validateInputs(); tabIndex=20 type=submit value=View name=ITEM1> 
</FORM>
</BODY>
</HTML> 



You need to call the JS function on Submit button onClick event.

onclick=validateInputs();

The function validates for, whether any value is enterd in Text box or not...


Thanks,

Ramkumar.
WebFOCUS/Tableau
Webfocus 8 / 7.7.02
Unix, Windows
HTML/PDF/EXCEL/AHTML/XML/HTML5
 
Posts: 394 | Location: Chennai | Registered: December 02, 2009Report This Post
Expert
posted Hide Post
Ramkumar, thanks for the example.


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
Pleasure is mine Smiler


Thanks,

Ramkumar.
WebFOCUS/Tableau
Webfocus 8 / 7.7.02
Unix, Windows
HTML/PDF/EXCEL/AHTML/XML/HTML5
 
Posts: 394 | Location: Chennai | Registered: December 02, 2009Report This Post
Expert
posted Hide Post
Interestingly, in document Designing a User Interface for a Web Application With the HTML Composer 7.6.9 & Higher, section "Using JavaScript Code With HTML Composer Pages", it is stated "Although the HTML Composer is fully integrated with JavaScript, it is suggested that you do not create custom JavaScript that manipulates the HTML Composer generated controls, as WebFOCUS cannot support such custom JavaScript code. Additionally, there is no guarantee that the JavaScript code will work correctly in future releases." That's all it says about JavaScript.


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
<JG>
posted
quote:
HTML Composer generated controls

That's correct.

Do not hack the control, what you work on is any parameter associated with the control.

For example an input text area is a control but the value you type in is the parameter.

Applying validation to what you type in based on an onChange action is not affecting the control
It's only affecting the input to the control.
 
Report This Post
Expert
posted Hide Post
But I have to add an onSubmit or onClick event handler somewhere, doesn't that "hack the control"?


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
Silver Member
posted Hide Post
Where to acquire the example/information/books of js that works in the
//Begin function button1_onclick
function button1_onclick(ctrl) {

}
//End function button1_onclick
The GUI interface and Pure JavaScript don’t work the same


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 37 | Registered: December 03, 2010Report This Post
Guru
posted Hide Post
quote:
But I have to add an onSubmit or onClick event handler somewhere, doesn't that "hack the control"?

Francis



Thatz not kind of Hacking the Control. Thatz adding the event handler attribute to the control.

Is there any other way built internally with the HTML composer, to add validation... In the new release ????


Thanks,

Ramkumar.
WebFOCUS/Tableau
Webfocus 8 / 7.7.02
Unix, Windows
HTML/PDF/EXCEL/AHTML/XML/HTML5
 
Posts: 394 | Location: Chennai | Registered: December 02, 2009Report This Post
Expert
posted Hide Post
Simple form with two text boxes and a submit button. When the submit button is clicked, I want to verify that something is entered in each of the two boxes. Easy in the real world, difficult in the GUI world.

I tried the onclick event handler. GUI creates "form2Submit_onclick" function. I put my validation in there. Validation works - alerts are displayed, but the form still gets submitted.

There is no onSubmit event handler in the GUI for this submit button.

How to control this???

Why does this kind of stuff make me feel like a beginner again? Shouldn't I feel like I'm graduating to something bigger?

<!-- Generated by Report Layout Painter -->
<HTML>
<HEAD>
<TITLE>HtmlPage</TITLE>
<BASE href=HTTP://localhost:80>
<SCRIPT id=clientEventHandlersJS type=text/javascript>
//Begin function window_onload
function window_onload() {

UpdateData();

// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
}
//End function window_onload

//Begin function form2Submit_onclick
function form2Submit_onclick(ctrl) {
if (document.getElementById('edit3').value == '')
  {
  alert('no country entered');
  return;
  }

if (document.getElementById('edit4').value == '')
  {
  alert('no seats entered');
  return;
  }
}
//End function form2Submit_onclick
</SCRIPT>

<SCRIPT for=window eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>

<META content="MSHTML 6.00.5730.13" name=GENERATOR></HEAD>
<BODY style="OVERFLOW: auto" edaconnectionrequired="false">
<FORM id=form2 style="Z-INDEX: 2; LEFT: 40px; WIDTH: 649px; POSITION: absolute; TOP: 30px; HEIGHT: 104px" tabIndex=2 name=form2 onsubmit="OnExecute(this);return false;" method=post fexlist_list="form2" form_dist_between_desc_and_input="10" form_hor_dist_between_controls="10" vert_dist_between_controls="10" form_number_of_columns="4" form_number_of_visible_rows="4" form_prompt_location="1" default_slider_type="4" requests_list="2" autoExecute="True">
<INPUT language=javascript id=form2Submit style="Z-INDEX: 3; LEFT: 5px; BACKGROUND-IMAGE: url(/ibi_html/javaassist/ibi/html/describe/run16.gif); WIDTH: 38px; BACKGROUND-REPEAT: no-repeat; POSITION: absolute; TOP: 77px; HEIGHT: 22px; BACKGROUND-COLOR: lavender" onclick=form2Submit_onclick(this) tabIndex=3 type=submit value=" " name=ITEM1> 
<INPUT id=form2Reset style="Z-INDEX: 4; LEFT: 48px; BACKGROUND-IMAGE: url(/ibi_html/javaassist/ibi/html/describe/reset.gif); WIDTH: 38px; BACKGROUND-REPEAT: no-repeat; POSITION: absolute; TOP: 77px; HEIGHT: 22px; BACKGROUND-COLOR: lavender" tabIndex=4 type=reset value=" " name=reset1> 
<FIELDSET id=form2_formbodyid style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; Z-INDEX: 5; LEFT: 5px; PADDING-BOTTOM: 0px; OVERFLOW: auto; WIDTH: 639px; BORDER-TOP-STYLE: none; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; POSITION: absolute; TOP: 5px; HEIGHT: 72px; BORDER-BOTTOM-STYLE: none" tabIndex=5 tempheight="72" tempwidth="639" formbody="1">  
<SPAN id=pane1 style="Z-INDEX: 9; LEFT: 5px; WIDTH: 95px; POSITION: absolute; TOP: 0px; HEIGHT: 51px" tabIndex=9 name="COUNTRY" elementtype="32">COUNTRY 
<INPUT id=edit3 style="Z-INDEX: 10; LEFT: 0px; WIDTH: 95px; POSITION: absolute; TOP: 29px; HEIGHT: 22px" tabIndex=10 hspace=0 maxLength=10 accept=0 size=10 name=COUNTRY defaultlocation="29,0,51,95" dfformat="A10" ibiformat="A10" displayfield="COUNTRY" datafield="COUNTRY" addalloption="0" operation="NONE" selectedvalue="ENGLAND" datasource boundtovariable="1" requiredfield="40950944" datatype="0" sourcetype="typeMaster"></SPAN> 
<SPAN id=pane2 style="Z-INDEX: 11; LEFT: 115px; WIDTH: 53px; POSITION: absolute; TOP: 0px; HEIGHT: 51px" tabIndex=11 name="SEATS" elementtype="32">SEATS 
<INPUT id=edit4 style="Z-INDEX: 12; LEFT: 0px; WIDTH: 53px; POSITION: absolute; TOP: 29px; HEIGHT: 22px" tabIndex=12 hspace=0 maxLength=3 accept=0 size=3 name=SEATS defaultlocation="29,0,51,53" dfformat="I3" ibiformat="I3" displayfield="SEATS" datafield="SEATS" addalloption="0" operation="NONE" selectedvalue="4" datasource boundtovariable="1" requiredfield="40950944" datatype="0" sourcetype="typeMaster"></SPAN></FIELDSET> 
<INPUT id=form2Schedule style="Z-INDEX: 8; LEFT: 91px; BACKGROUND-IMAGE: url(/ibi_html/javaassist/ibi/html/describe/schedule.gif); WIDTH: 38px; BACKGROUND-REPEAT: no-repeat; POSITION: absolute; TOP: 77px; HEIGHT: 22px; BACKGROUND-COLOR: lavender" onclick="OnExecute(this);return false;" tabIndex=8 type=button value=" " name=button1 requests_list="4"></FORM>
<xml id=ibi_requests>
<script>
	
<requests>
		
<request requestid="2" sourcetype="typeFex" targettype="window" targetname="_blank" ibif_ex="app/fmtest1.fex" IBIMR_domain="rbco2dvl/rbco2dvl.htm" IBIMR_folder="#fmtesttq9xrq" IBIMR_sub_action="MR_STD_REPORT" activereport="0" reportcolumns="" ibiapp_app="">
			
<variables>
				
<variable parametercreatedinreslay="0" displayfield="COUNTRY" format="" field="COUNTRY" file="car.mas" desc="COUNTRY" datatype="0" operation="" default="ENGLAND" name="COUNTRY" textvarname="" accept="0" type="default" select="0" min="" max="" controltype="7" create="1"></variable>
				
<variable parametercreatedinreslay="0" displayfield="SEATS" format="" field="SEATS" file="car.mas" desc="SEATS" datatype="0" operation="" default="4" name="SEATS" textvarname="" accept="0" type="default" select="0" min="" max="" controltype="7" create="1"></variable></variables></request>
		
<request requestid="4" sourcetype="typeschedule" targettype="reportcaster" targetname="EmailLibraryFTP" ibif_ex="app/fmtest1.fex" IBIMR_domain="rbco2dvl/rbco2dvl.htm" IBIMR_folder="#fmtesttq9xrq" IBIMR_sub_action="MR_STD_REPORT" activereport="0" reportcolumns="" ibiapp_app="">
			
<variables>
				
<variable parametercreatedinreslay="0" displayfield="COUNTRY" format="" field="COUNTRY" file="car.mas" desc="COUNTRY" datatype="0" operation="" default="ENGLAND" name="COUNTRY" textvarname="" accept="0" type="default" select="0" min="" max="" controltype="7" create="1"></variable>
				
<variable parametercreatedinreslay="0" displayfield="SEATS" format="" field="SEATS" file="car.mas" desc="SEATS" datatype="0" operation="" default="4" name="SEATS" textvarname="" accept="0" type="default" select="0" min="" max="" controltype="7" create="1"></variable></variables></request></requests></script>
</xml></BODY></HTML>

This message has been edited. Last edited by: Francis Mariani,


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
 
function form2Submit_onclick(ctrl) {
if (document.getElementById('edit3').value == '')
  {
  alert('no country entered');
  return;
  }

if (document.getElementById('edit4').value == '')
  {
  alert('no seats entered');
  return;
  }
document.form2.submit();
}


This is the way. You can Submit the Form in the JS function, once all validations passes on.

 document.form2.submit();


Doing OnSubmit inside OnClick... Thatz that.


Thanks,

Ramkumar.
WebFOCUS/Tableau
Webfocus 8 / 7.7.02
Unix, Windows
HTML/PDF/EXCEL/AHTML/XML/HTML5
 
Posts: 394 | Location: Chennai | Registered: December 02, 2009Report This Post
Expert
posted Hide Post
Except that this submit overrides the GUI submit which is buried somewhere in the external javascript, and who knows what this will break.

I know I can do my validation with an onclick event handler on the "fake" submit button, the question is, how do I stop the formm from being submitted? My validation function works, it alerts the errors but it doesn't stop the form from being submitted.

This message has been edited. Last edited by: Francis Mariani,


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
Silver Member
posted Hide Post
Francis,
Here is a quick mock up of what your asking....

<form action="somepage.asp" method="post" onsubmit="return aValdiationFunction();">
<input type="submit" name="submit" value="push my button" />
</form>

<script>
function aValdiationFunction()
{
var does_something = false;

does_something = window.confirm("do you like rabbits?");
if (does_something)
return true;
else
return false;
}
</script>



you simply perform all tests you need to perform on the form objects and if it pass the tests you return true otherwise you return false from the function.

true = the form submitting
false = no submission


Let me know if you little more detailed example.


Jay

This message has been edited. Last edited by: Lucas,


7.6.6 Mainframe
7.6.4 Web Focus
Windows

 
Posts: 45 | Location: Gaffney SC | Registered: March 30, 2007Report This Post
<FreSte>
posted
Francis,

I'm not sure if this will break something (now or in the future), but this is maybe getting close to what you want.


1: Change the form-event into onsubmit="myOnExecute(this);return false;"
2: Create function myOnExecute

function myOnExecute(ctrl) {
  var _msg = checkit();
  if ( _msg == "") {
    OnExecute(ctrl);
  }
  else {
    alert(_msg);
  }
}


3: Create the checkit function
function checkit() {
  var _str = "";
  if (document.getElementById("edit3").value == "")  {
    _str += "no country entered" + "\n";
  }

  if (document.getElementById("edit4").value == "")  {
    _str += "no seats entered" + "\n";
  }
  return _str;
}


-Fred-
 
Report This Post
Expert
posted Hide Post
Thanks for the sample JavaScript. I have created hand-coded forms for years and know how to validate and control form submission.

I need to do this within a GUI-generated html form, without breaking anything.

At the moment, there is no onSubmit on the submit button because it's not a submit button but a regular button - the GUI does not create submit buttons.

14:55 - CORRECTION! It IS a form submit button. I added the onclick event handler via the GUI.

This message has been edited. Last edited by: Francis Mariani,


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
Member
posted Hide Post
I think it's a bug within the Form generation of the GUI tool. The form tag has 'onsubmit="OnExecute(this);return false;"' on it, and really it needs to be calling another javascript function that does the OnExecute so you can add your edits around it and prevent the form from submitting. When you use the tool, if you tell it to not generate a Form it will create this type of code for you, this should work the same way.

You can go into the code and change it around to work and it seems to work fine without breaking anything, but if you are doing everything in the GUI...you shouldn't have to do this.

Bob




Prod: WebFocus/ReportCaster 7.6.10 - Self Service - Windows 2003 Server - IIS/Tomcat

Test: WebFocus/ReportCaster 7.6.10 - Self Service - Windows 2003 Server - IIS/Tomcat

Databases: MS SQL Server, Focus DB, Output: HTML, Excel 2000 and PDF
 
Posts: 21 | Registered: July 06, 2007Report This Post
Expert
posted Hide Post
Bob,

I think you've hit the nail on the noggin!

A formless parameter screen has a submit button with a onclick event handler pointing to submitButton_OnClick(this). This function has a comment line // TODO: Add validation code here, then executes OnExecute(ctrl). THIS MAKES SENSE.

A parameter screen WITH a form has a submit button with no onclick event handler, unless I add one. The form itself has a onsubmit event handler that executes OnExecute(this). THIS DOES NOT MAKE SENSE.

Perhaps I can add the validation function call to the form onsubmit event handler, but I don't know if it will break the GUI...

Thanks for pointing this out. Case-opening time.


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
Expert
posted Hide Post
Exhibit 1, an HTML Composer example with form validation. Please see the form onsubmit event handler. I've added a call to a validation function. I would like to validate the form and NOT SUBMIT the form if an error was found. This code does not work - it validates the form correctly but the form gets submitted regardless of error.

<!-- Generated by Report Layout Painter -->
<HTML>
<HEAD>
<SCRIPT id=IBI_RelCallBack type=text/javascript>function AdjustChildrenPosition(){
}
</SCRIPT>

<SCRIPT id=IBI_OptionsScript type=text/javascript>
var rltVersion = "764";
var cgipath = "cgipath";
var ibirls = "ibirls2";

var rltdyncalendar = "rltdyncalendar";
var gmap = "ibigmap";
var olap="olap";
var olappanebase="olappanebase";
var olapdrill="olapdrill";

var ibixmltree="ibixmltree";

var ibiOptions = new Array(cgipath,ibirls);
</SCRIPT>

<SCRIPT id=IBI_nls src="/ibi_html/javaassist/nls.js" type=text/javascript></SCRIPT>

<SCRIPT id=IBI_ibigbl src="/ibi_html/javaassist/ibi/html/js/ibigbl.js" type=text/javascript></SCRIPT>

<SCRIPT id=IBI_ibigblloadCss type=text/javascript>
ibigblloadCss(null);</SCRIPT>
<TITLE>HtmlPage</TITLE>
<SCRIPT id=clientEventHandlersJS type=text/javascript>
//Begin function window_onload
function window_onload() {

UpdateData();

// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
}
//End function window_onload

function onInitialUpdate()
{
alert('onInitialUpdate');
document.getElementById('edit1').value = 'JAPAN';
document.getElementById('edit2').value = '4';
}

function ValidateForm()
{
alert('ValidateForm');
if (document.getElementById('edit1').value == '')
  {
  alert('Please enter a Country');
  return false;
  }

if (document.getElementById('edit2').value == '')
  {
  alert('Please enter the number of Seats');
  return false;
  }
}
</SCRIPT>

<SCRIPT for=window eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
</HEAD>
<BODY style="OVERFLOW: auto" edaconnectionrequired="false">
<FORM id=form2 style="Z-INDEX: 2; LEFT: 30px; WIDTH: 320px; POSITION: absolute; TOP: 20px; HEIGHT: 180px" tabIndex=2 name=form2 onsubmit="ValidateForm();OnExecute(this);return false;" method=post fexlist_list="form2" requests_list="0" default_slider_type="4" form_prompt_location="1" form_number_of_visible_rows="4" form_number_of_columns="4" vert_dist_between_controls="10" form_hor_dist_between_controls="10" form_dist_between_desc_and_input="10">
<INPUT id=form2Submit style="Z-INDEX: 3; LEFT: 10px; BACKGROUND-IMAGE: url(/ibi_html/javaassist/ibi/html/describe/run16.gif); WIDTH: 38px; BACKGROUND-REPEAT: no-repeat; POSITION: absolute; TOP: 140px; HEIGHT: 22px; BACKGROUND-COLOR: lavender" tabIndex=3 type=submit value=" " name=ITEM1>
<INPUT id=form2Reset style="Z-INDEX: 4; LEFT: 60px; BACKGROUND-IMAGE: url(/ibi_html/javaassist/ibi/html/describe/reset.gif); WIDTH: 38px; BACKGROUND-REPEAT: no-repeat; POSITION: absolute; TOP: 140px; HEIGHT: 22px; BACKGROUND-COLOR: lavender" tabIndex=4 type=reset value=" " name=reset1>
<FIELDSET id=form2_formbodyid style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; Z-INDEX: 5; LEFT: 5px; PADDING-BOTTOM: 0px; OVERFLOW: auto; WIDTH: 179px; BORDER-TOP-STYLE: none; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; POSITION: absolute; TOP: 5px; HEIGHT: 72px; BORDER-BOTTOM-STYLE: none" tabIndex=5 tempheight="72" tempwidth="179" formbody="1">
<SPAN id=pane1 style="Z-INDEX: 7; LEFT: 0px; WIDTH: 95px; POSITION: absolute; TOP: 0px; HEIGHT: 51px" tabIndex=7 name="COUNTRY" elementtype="32">COUNTRY
<INPUT id=edit1 style="Z-INDEX: 8; LEFT: 0px; WIDTH: 95px; POSITION: absolute; TOP: 29px; HEIGHT: 22px" tabIndex=8 hspace=0 maxLength=10 accept=0 size=10 name=COUNTRY defaultlocation="29,0,51,95" dfformat="A10" ibiformat="A10" displayfield="COUNTRY" datafield="COUNTRY" addalloption="0" operation="NONE" selectedvalue="ENGLAND" datasource boundtovariable="1" requiredfield="46936008" datatype="0" sourcetype="typeMaster"></SPAN>
<SPAN id=pane2 style="Z-INDEX: 9; LEFT: 105px; WIDTH: 53px; POSITION: absolute; TOP: 0px; HEIGHT: 51px" tabIndex=9 name="SEATS" elementtype="32">SEATS
<INPUT id=edit2 style="Z-INDEX: 10; LEFT: 0px; WIDTH: 53px; POSITION: absolute; TOP: 29px; HEIGHT: 22px" tabIndex=10 hspace=0 maxLength=3 accept=0 size=3 name=SEATS defaultlocation="29,0,51,53" dfformat="I3" ibiformat="I3" displayfield="SEATS" datafield="SEATS" addalloption="0" operation="NONE" selectedvalue="4" datasource boundtovariable="1" requiredfield="46936008" datatype="0" sourcetype="typeMaster"></SPAN></FIELDSET>
<INPUT id=form2Schedule style="Z-INDEX: 6; LEFT: 110px; BACKGROUND-IMAGE: url(/ibi_html/javaassist/ibi/html/describe/schedule.gif); WIDTH: 38px; BACKGROUND-REPEAT: no-repeat; POSITION: absolute; TOP: 140px; HEIGHT: 22px; BACKGROUND-COLOR: lavender" onclick="OnExecute(this);return false;" tabIndex=6 type=button value=" " name=button1 requests_list="2"></FORM>
<INPUT id=layoutinfo style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden inputcontrolids="edit1;edit2" schedulecontrolids="form2Schedule">
<INPUT id=IBIMR_domain style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden value=fmtest00/fmtest00.htm name=IBIMR_domain>
<INPUT id=IBIMR_folder style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden value=#fmtestow4dj0 name=IBIMR_folder>
<INPUT id=ibif_ex style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden value=app/fmscreen1.htm name=ibif_ex>
<INPUT id=ibiapp_app style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden name=ibiapp_app ismre="1">
<INPUT id=ibic_server style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden value=EDASERVE name=ibic_server>
<xml id=ibi_requests>
<script>

<requests>

<request requestid="0" sourcetype="typeFex" targettype="window" targetname="_blank" ibif_ex="app/fmtest1.fex" IBIMR_domain="fmtest00/fmtest00.htm" IBIMR_folder="#fmtestow4dj0" IBIMR_sub_action="MR_STD_REPORT" activereport="0" reportcolumns="" ibiapp_app="">

<variables>

<variable parametercreatedinreslay="0" displayfield="COUNTRY" format="" field="COUNTRY" file="car.mas" desc="COUNTRY" datatype="0" operation="" default="ENGLAND" name="COUNTRY" textvarname="" accept="0" type="default" select="0" min="" max="" controltype="7" create="1"></variable>

<variable parametercreatedinreslay="0" displayfield="SEATS" format="" field="SEATS" file="car.mas" desc="SEATS" datatype="0" operation="" default="4" name="SEATS" textvarname="" accept="0" type="default" select="0" min="" max="" controltype="7" create="1"></variable></variables></request>

<request requestid="2" sourcetype="typeschedule" targettype="reportcaster" targetname="EmailLibraryFTP" ibif_ex="app/fmtest1.fex" IBIMR_domain="fmtest00/fmtest00.htm" IBIMR_folder="#fmtestow4dj0" IBIMR_sub_action="MR_STD_REPORT" activereport="0" reportcolumns="" ibiapp_app="">

<variables>

<variable parametercreatedinreslay="0" displayfield="COUNTRY" format="" field="COUNTRY" file="car.mas" desc="COUNTRY" datatype="0" operation="" default="ENGLAND" name="COUNTRY" textvarname="" accept="0" type="default" select="0" min="" max="" controltype="7" create="1"></variable>

<variable parametercreatedinreslay="0" displayfield="SEATS" format="" field="SEATS" file="car.mas" desc="SEATS" datatype="0" operation="" default="4" name="SEATS" textvarname="" accept="0" type="default" select="0" min="" max="" controltype="7" create="1"></variable></variables></request></requests></script>
</xml></BODY>
<SCRIPT id=IBI_loader type=text/javascript>
doBeforeLoad();
</SCRIPT>
</HTML>



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
Expert
posted Hide Post
Exhibit 2: I've moved the IBI-supplied OnExecute "submit" function to the validate function and this SEEMS TO WORK!

<!-- Generated by Report Layout Painter -->
<HTML>
<HEAD>
<SCRIPT id=IBI_RelCallBack type=text/javascript>function AdjustChildrenPosition(){
}
</SCRIPT>

<SCRIPT id=IBI_OptionsScript type=text/javascript>
var rltVersion = "764";
var cgipath = "cgipath";
var ibirls = "ibirls2";

var rltdyncalendar = "rltdyncalendar";
var gmap = "ibigmap";
var olap="olap";
var olappanebase="olappanebase";
var olapdrill="olapdrill";

var ibixmltree="ibixmltree";

var ibiOptions = new Array(cgipath,ibirls);
</SCRIPT>

<SCRIPT id=IBI_nls src="/ibi_html/javaassist/nls.js" type=text/javascript></SCRIPT>

<SCRIPT id=IBI_ibigbl src="/ibi_html/javaassist/ibi/html/js/ibigbl.js" type=text/javascript></SCRIPT>

<SCRIPT id=IBI_ibigblloadCss type=text/javascript>
ibigblloadCss(null);</SCRIPT>
<TITLE>HtmlPage</TITLE>
<SCRIPT id=clientEventHandlersJS type=text/javascript>
//Begin function window_onload
function window_onload() {

UpdateData();

// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
}
//End function window_onload

function onInitialUpdate()
{
//alert('onInitialUpdate');
document.getElementById('edit1').value = 'JAPAN';
document.getElementById('edit2').value = '4';
}

function ValidateForm(ctrl)
{
//alert('ValidateForm');
if (document.getElementById('edit1').value == '')
  {
  alert('Please enter a Country');
  document.getElementById('edit1').focus();
  }
else if (document.getElementById('edit2').value == '')
  {
  alert('Please enter the number of Seats');
  document.getElementById('edit2').focus();
  }
else
  {
  OnExecute(ctrl);
  }
}
</SCRIPT>

<SCRIPT for=window eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
</HEAD>
<BODY style="OVERFLOW: auto" edaconnectionrequired="false">
<FORM id=form2 style="Z-INDEX: 2; LEFT: 20px; WIDTH: 470px; POSITION: absolute; TOP: 20px; HEIGHT: 280px" tabIndex=2 name=form2 onsubmit="ValidateForm(this);return false;" method=post fexlist_list="form2" requests_list="0" default_slider_type="4" form_prompt_location="1" form_number_of_visible_rows="4" form_number_of_columns="4" vert_dist_between_controls="10" form_hor_dist_between_controls="10" form_dist_between_desc_and_input="10">
<INPUT id=form2Submit style="Z-INDEX: 3; LEFT: 20px; BACKGROUND-IMAGE: url(/ibi_html/javaassist/ibi/html/describe/run16.gif); WIDTH: 38px; BACKGROUND-REPEAT: no-repeat; POSITION: absolute; TOP: 220px; HEIGHT: 22px; BACKGROUND-COLOR: lavender" tabIndex=3 type=submit value=" " name=ITEM1>
<INPUT id=form2Reset style="Z-INDEX: 4; LEFT: 90px; BACKGROUND-IMAGE: url(/ibi_html/javaassist/ibi/html/describe/reset.gif); WIDTH: 38px; BACKGROUND-REPEAT: no-repeat; POSITION: absolute; TOP: 220px; HEIGHT: 22px; BACKGROUND-COLOR: lavender" tabIndex=4 type=reset value=" " name=reset1>
<FIELDSET id=form2_formbodyid style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; Z-INDEX: 5; LEFT: 5px; PADDING-BOTTOM: 0px; OVERFLOW: auto; WIDTH: 179px; BORDER-TOP-STYLE: none; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; POSITION: absolute; TOP: 5px; HEIGHT: 72px; BORDER-BOTTOM-STYLE: none" tabIndex=5 tempheight="72" tempwidth="179" formbody="1">
<SPAN id=pane1 style="Z-INDEX: 7; LEFT: 0px; WIDTH: 95px; POSITION: absolute; TOP: 0px; HEIGHT: 51px" tabIndex=7 name="COUNTRY" elementtype="32">COUNTRY
<INPUT id=edit1 style="Z-INDEX: 8; LEFT: 0px; WIDTH: 95px; POSITION: absolute; TOP: 29px; HEIGHT: 22px" tabIndex=8 hspace=0 maxLength=10 accept=0 size=10 name=COUNTRY defaultlocation="29,0,51,95" dfformat="A10" ibiformat="A10" displayfield="COUNTRY" datafield="COUNTRY" addalloption="0" operation="NONE" selectedvalue="ENGLAND" datasource boundtovariable="1" requiredfield="77250928" datatype="0" sourcetype="typeMaster"></SPAN>
<SPAN id=pane2 style="Z-INDEX: 9; LEFT: 105px; WIDTH: 53px; POSITION: absolute; TOP: 0px; HEIGHT: 51px" tabIndex=9 name="SEATS" elementtype="32">SEATS
<INPUT id=edit2 style="Z-INDEX: 10; LEFT: 0px; WIDTH: 53px; POSITION: absolute; TOP: 29px; HEIGHT: 22px" tabIndex=10 hspace=0 maxLength=3 accept=0 size=3 name=SEATS defaultlocation="29,0,51,53" dfformat="I3" ibiformat="I3" displayfield="SEATS" datafield="SEATS" addalloption="0" operation="NONE" selectedvalue="4" datasource boundtovariable="1" requiredfield="77250928" datatype="0" sourcetype="typeMaster"></SPAN></FIELDSET>
<INPUT id=form2Schedule style="Z-INDEX: 6; LEFT: 170px; BACKGROUND-IMAGE: url(/ibi_html/javaassist/ibi/html/describe/schedule.gif); WIDTH: 38px; BACKGROUND-REPEAT: no-repeat; POSITION: absolute; TOP: 220px; HEIGHT: 22px; BACKGROUND-COLOR: lavender" onclick="OnExecute(this);return false;" tabIndex=6 type=button value=" " name=button1 requests_list="2"></FORM>
<INPUT id=layoutinfo style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden inputcontrolids="edit1;edit2" schedulecontrolids="form2Schedule">
<INPUT id=IBIMR_domain style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden value=fmtest00/fmtest00.htm name=IBIMR_domain>
<INPUT id=IBIMR_folder style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden value=#fmtestow4dj0 name=IBIMR_folder>
<INPUT id=ibif_ex style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden value=app/fmscreen2.htm name=ibif_ex>
<INPUT id=ibiapp_app style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden name=ibiapp_app ismre="1">
<INPUT id=ibic_server style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden value=EDASERVE name=ibic_server>
<xml id=ibi_requests>
<script>
<requests>
<request requestid="0" sourcetype="typeFex" targettype="window" targetname="_blank" ibif_ex="app/fmtest1.fex" IBIMR_domain="fmtest00/fmtest00.htm" IBIMR_folder="#fmtestow4dj0" IBIMR_sub_action="MR_STD_REPORT" activereport="0" reportcolumns="" ibiapp_app="">
<variables>
<variable parametercreatedinreslay="0" displayfield="COUNTRY" format="" field="COUNTRY" file="car.mas" desc="COUNTRY" datatype="0" operation="" default="ENGLAND" name="COUNTRY" textvarname="" accept="0" type="default" select="0" min="" max="" controltype="7" create="1"></variable>
<variable parametercreatedinreslay="0" displayfield="SEATS" format="" field="SEATS" file="car.mas" desc="SEATS" datatype="0" operation="" default="4" name="SEATS" textvarname="" accept="0" type="default" select="0" min="" max="" controltype="7" create="1"></variable></variables></request>
<request requestid="2" sourcetype="typeschedule" targettype="reportcaster" targetname="EmailLibraryFTP" ibif_ex="app/fmtest1.fex" IBIMR_domain="fmtest00/fmtest00.htm" IBIMR_folder="#fmtestow4dj0" IBIMR_sub_action="MR_STD_REPORT" activereport="0" reportcolumns="" ibiapp_app="">
<variables>
<variable parametercreatedinreslay="0" displayfield="COUNTRY" format="" field="COUNTRY" file="car.mas" desc="COUNTRY" datatype="0" operation="" default="ENGLAND" name="COUNTRY" textvarname="" accept="0" type="default" select="0" min="" max="" controltype="7" create="1"></variable>
<variable parametercreatedinreslay="0" displayfield="SEATS" format="" field="SEATS" file="car.mas" desc="SEATS" datatype="0" operation="" default="4" name="SEATS" textvarname="" accept="0" type="default" select="0" min="" max="" controltype="7" create="1"></variable></variables></request></requests></script>
</xml></BODY>
<SCRIPT id=IBI_loader type=text/javascript>
doBeforeLoad();
</SCRIPT>
</HTML>



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
Expert
posted Hide Post
This type of thing needs to be documented.

"If you need to validate the form, do this: ...".

Why do I have to go through the pain of invention, I cannot be the first person to attempt this?

Thanks to FreSte...


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
Member
posted Hide Post
Bob said:
quote:
I think it's a bug within the Form generation of the GUI tool. The form tag has 'onsubmit="OnExecute(this);return false;"' on it, and really it needs to be calling another javascript function that does the OnExecute so you can add your edits around it and prevent the form from submitting. When you use the tool, if you tell it to not generate a Form it will create this type of code for you, this should work the same way.

You can go into the code and change it around to work and it seems to work fine without breaking anything, but if you are doing everything in the GUI...you shouldn't have to do this.


In 7.1.6 this is how the validation for onsubmit worked. I have several HTML pages which were using Javascript to perform field level validation which used this format for onsubmit: 'onsubmit="OnExecute(this);return false; what you would do is put your validation code in the middle of the code like this: 'onsubmit="OnExecute(this);validationscript();return false;"

When we upgraded to 7.6.10 two weeks ago however, every one of those pages failed to work. When running from the dashboard they would reset all the fields and do nothing. When working with them in Dev Studio and running to see results from Dev Studio they would not load the page properly. It would continuously act as if the browser was trying to load the page but would throw and error on page which when I traced was found to be in the composer.js file now included with the composer. this is a new file from 7.1.6.

Monday I am hoping to work with my server guy and run more accurate traces and see why none of my validations will work. I now can't get anything to work with composer and had to remove them for now and let the server handle validation instead of the client. Client is not only more efficient for the user but also is better on the server performance and load tolerance.

I agree that there should be better ways to create validations with WebFOCUS. Most 4th Generation Languages have some validation capabilities. Even Adobe forms allows for number, length, date, and ssn validations with coding script on the fields.

I will try to keep you posted on my results next week with the server guy.

Rita


7.6.10 Oracle 10g Windows XP
 
Posts: 11 | Registered: January 10, 2011Report This Post
Expert
posted Hide Post
Ouch! I feel your pain.

Even if form validation is not included in HTML Composer, the darn thing shouldn't make it hard for us to do it ourselves.


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
Amen Francis! And thank you for your post....it worked perfect for me.

Michelle


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
 
Posts: 272 | Location: Kalamazoo, Michigan | Registered: September 30, 2010Report This Post
Expert
posted Hide Post
Michelle,

I'm happy you worked it out. There's at least one thing to worry about: what will happen to the code when the HTML page is opened in a newer version of Dev Studio Layout Composer, so, keep your eyes and ears open when you upgrade!


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
Virtuoso
posted Hide Post
Thanks all for the hints and Francis for leading me here!

This message has been edited. Last edited by: njsden,



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report 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     [CLOSED] Dev Studio GUI Newbie Question: Where to add form validation?

Copyright © 1996-2020 Information Builders