Focal Point
[CLOSED] Requiring 2 text boxes in HTML

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4577071826

January 23, 2013, 04:30 PM
paulI
[CLOSED] Requiring 2 text boxes in HTML
Greetings. I have a situation where I have a first and last name field on an HTML created in HTML Painter and need to require the first name if the last name has been entered. I do not know Java script (yet) and was wondering if someone had an example. I know chaining does not work on text boxes. I have searched for 'required parameters' but no luck. Thank you in advance.
Paul

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


Prod: WF 7.7.05, BID, MRE, 7.7.06M Server, Windows 2008, RedHat, Oracle 11gR1, MS Office 2010
Test: I wish we had one!
January 24, 2013, 09:25 AM
BarryS
Hi Paul

you can create an event by clicking last name control - onchange. Then in the JavaScript function you can use: var lname = IbComposer_getCurrentSelection('lname_controlname') and IbComposer_getCurrentSelection('fname_controlname') to get the selected value. Then use a if statement to test if
you have a value in lname and fname. you can then do an alert('Please enter your first name');

If you have problems, open a case with tech support.

Thanks Barry


WebFOCUS 8103, Windows, App Studio
January 24, 2013, 02:39 PM
Anatess
Here's a quick-and-dirty example using the CAR file. Let me know if you have questions on the code. The main thing to look at is function button1_onclick() which is tied to the "fake" submit button's onclick event (just a plain button that looks like the submit button). The actual submit button is actually not displayed. So, when you click on the "fake submit button" it runs some javascript that decides whether to programatically click the real submit button or not.

This was written in version 7.7.03
<HTML>
<HEAD>
<META id=mycharsetmeta content="text/html; charset=ISO-8859-1" http-equiv=Content-Type>
<META id=Generation content="Created in release 7703, Generation 3.0">
<script id=IBI_RelCallBack type=text/javascript>function AdjustChildrenPosition(){
}
</SCRIPT>

<script id=IBI_OptionsScript type=text/javascript>
var cgipath = "cgipath";
var ibirls = "ibirls3";

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 type=text/javascript src="/ibi_html/javaassist/nls.js"></SCRIPT>

<script id=IBI_nlsVars type=text/javascript src="/ibi_html/javaassist/nlsvars.js"></SCRIPT>

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

<script id=IBI_ibigblloadCss type=text/javascript>
ibigblloadCss(null);
addIntlTranslatedJS("composertrans.js");
</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

//Begin function button1_onclick
function button1_onclick(ctrl) {
if (document.getElementById("edit1").value == null || document.getElementById("edit1").value == "")
 {
  document.getElementById("submit1").click();
 }
else
 {
  if (document.getElementById("edit2").value == null || document.getElementById("edit2").value == "")
   {
    alert("If Country is filled, Car must also be filled");
   }
  else
   {
    document.getElementById("submit1").click();
   }
 }
}
//End function button1_onclick
</SCRIPT>

<script for=window type=text/javascript eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
</HEAD>
<BODY style="OVERFLOW: auto" nextelementuniquenumber="4" thumbnailscale="4" elementtype="21" edaconnectionrequired="true">
<FORM style="Z-INDEX: 2; POSITION: absolute; WIDTH: 379px; HEIGHT: 110px; TOP: 10px; LEFT: 20px" id=form1 onsubmit="OnExecute[this);return false;" method=post tempheight="110" tempwidth="379" fexlist_list="report1" form_newline_chain="1" default_slider_type="4" form_type="1" 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" requests_list="1;0" name="form1">
<LABEL style="Z-INDEX: 5; POSITION: absolute; WIDTH: 59px; HEIGHT: 19px; TOP: 5px; CURSOR: default; LEFT: 5px" id=label1 for=edit1 name="edit1">INCTRY</LABEL> 
<INPUT style="Z-INDEX: 6; POSITION: absolute; OVERFLOW-Y: visible; WIDTH: 166px; HEIGHT: 22px; OVERFLOW: visible; TOP: 34px; LEFT: 5px" id=edit1 tabIndex=1 hspace=0 defaultlocation="0,0,22,146" boundtovariable="1" persistentuniqueid="compUid_1" name="edit1"> 
<LABEL style="Z-INDEX: 7; POSITION: absolute; WIDTH: 50px; HEIGHT: 19px; TOP: 5px; CURSOR: default; LEFT: 181px" id=label2 for=edit2 name="edit2">INCAR</LABEL> 
<INPUT style="Z-INDEX: 8; POSITION: absolute; OVERFLOW-Y: visible; WIDTH: 166px; HEIGHT: 22px; OVERFLOW: visible; TOP: 34px; LEFT: 181px" id=edit2 tabIndex=2 hspace=0 defaultlocation="0,0,22,146" boundtovariable="1" persistentuniqueid="compUid_2" name="edit2"> 
<INPUT style="Z-INDEX: 3; POSITION: absolute; BACKGROUND-COLOR: lavender; WIDTH: 38px; DISPLAY: none; BACKGROUND-REPEAT: no-repeat; HEIGHT: 22px; TOP: 83px; LEFT: 5px" id=form1Submit value=" " type=submit StyleBack_rtFileName="htmlpathsub/javaassist/ibi/html/describe/run16.gif" name="submit1"> 
<INPUT style="Z-INDEX: 3; POSITION: absolute; BACKGROUND-COLOR: lavender; WIDTH: 38px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 22px; TOP: 83px; LEFT: 5px" id=button1 language=java_script tabIndex=3 onclick=button1_onclick[this) value=" " type=button StyleBack_rtFileName="htmlpathsub/javaassist/ibi/html/describe/run16.gif" name="button1"> 
<INPUT style="Z-INDEX: 4; POSITION: absolute; BACKGROUND-COLOR: lavender; WIDTH: 38px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 22px; TOP: 83px; LEFT: 48px" id=form1Reset tabIndex=4 value=" " type=reset StyleBack_rtFileName="htmlpathsub/javaassist/ibi/html/describe/reset.gif" name="reset1"></FORM>
<iframe style="Z-INDEX: 9; POSITION: absolute; WIDTH: 940px; HEIGHT: 330px; TOP: 130px; LEFT: 20px" id=report1 elementtype="2" requests_list="1" persistentuniqueid="compUid_4" autoExecute="false" name="report1"></IFRAME>  
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=layoutinfo type=hidden>
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibiapp_app value="ibisamp baseapp" type=hidden name="ibiapp_app">
<xml id=focus_xmlelement>
<script type="text/xml" nextelementuniquenumber="5">
	
<rootxmlnode focoption="_FOC_NULL" top="100" left="10" width="150" height="130">
		
<variables>
			
<variable controltype="7" parametercreatedinreslay="0" type="unresolved" desc="INCTRY" name="INCTRY" default="" textvarname="" accept="0" select="0" create="1" top="70" left="30" width="60" height="20" inbinding="1">
				
<link linktype="default" persistentuniqueid="compUid_2" from="compUid_1">
					
<condition default="1" name="Default" whattodowithcontrol="4" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
						
<data_info checkForDuplicateValues="0" displayfield="INCTRY" datafield="INCTRY" datasource="car.mas" datatype="0" selectedvalue="" operation="" slider_range_from="" slider_range_to="" previewvalue="" linktype="none" sourcetype="typeMaster"></data_info></condition></link>
				
<requestid id="1"></requestid>
				
<requestid id="0"></requestid></variable>
			
<variable controltype="7" parametercreatedinreslay="0" type="unresolved" desc="INCAR" name="INCAR" default="" textvarname="" accept="0" select="0" create="1" top="70" left="140" width="60" height="20" inbinding="1">
				
<link linktype="default" persistentuniqueid="compUid_3" from="compUid_2">
					
<condition default="1" name="Default" whattodowithcontrol="4" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
						
<data_info checkForDuplicateValues="0" displayfield="INCAR" datafield="INCAR" datasource="car.mas" datatype="0" selectedvalue="" operation="" slider_range_from="" slider_range_to="" previewvalue="" linktype="none" sourcetype="typeMaster"></data_info></condition></link>
				
<requestid id="1"></requestid>
				
<requestid id="0"></requestid></variable></variables>
		
<input_controls>
			
<input_control bindcontrolid="compUid_1" elementtype="7" name="edit1" id="edit1" multiple="0" onetimepopulated="1" inbinding="1" top="20" left="30" width="60" height="20">
				
<link linktype="default" persistentuniqueid="compUid_1">
					
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
						
<data_info checkForDuplicateValues="0" datatype="0" datasource="" addalloption="0" sourcetype="typeMaster" cacheruntimedata="0" accept="0" operation="NONE" displayfield="" datafield="" selectedvalue="" modifiedrequest="1">
							
< ![CDATA[]]></data_info></condition></link></input_control>
			
<input_control bindcontrolid="compUid_2" elementtype="7" name="edit2" id="edit2" multiple="0" onetimepopulated="1" inbinding="1" top="20" left="140" width="60" height="20">
				
<link linktype="default" persistentuniqueid="compUid_4">
					
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
						
<data_info checkForDuplicateValues="0" datatype="0" datasource="" addalloption="0" sourcetype="typeMaster" cacheruntimedata="0" accept="0" operation="NONE" displayfield="" datafield="" selectedvalue="" modifiedrequest="1">
							
< ![CDATA[]]></data_info></condition></link></input_control></input_controls>
		
<other_bound_objects></other_bound_objects>
		
<requests nextrequestsid="1">
			
<request requestid="0" targetname="report1" ibif_ex="car.fex" targettype="iframe" sourcetype="typeFex" activereport="0" compoundreport="0" reportcolumns="" reportrealcolumns="" ibiapp_app="ibisamp baseapp"></request>
			
<request requestid="1" targetname="report1" ibif_ex="report1" targettype="iframe" sourcetype="typeAdhocfex" activereport="0" compoundreport="0" reportcolumns="" reportrealcolumns="" ibiapp_app="">
				
< ![CDATA[-SET &ECHO=ALL;
-SET &INCTRY=IF &INCTRY = '' THEN 'FOC_NONE' ELSE &INCTRY;
-SET &INCAR=IF &INCAR= '' THEN 'FOC_NONE' ELSE &INCAR;
SET EMPTYREPORT=ON
TABLE FILE CAR
PRINT 
     CAR.COMP.CAR
BY  LOWEST CAR.ORIGIN.COUNTRY
WHERE CAR.ORIGIN.COUNTRY EQ '&INCTRY';
WHERE CAR.COMP.CAR EQ '&INCAR';
ON TABLE SET PAGE-NUM NOLEAD 
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = endeflt,
$
TYPE=REPORT,
     GRAPHCOLOR='GREEN',
$
TYPE=REPORT,
     OBJECT=MENU,
     COLOR='WHITE',
     HOVER-COLOR=RGB(66 70 73),
     BACKCOLOR=RGB(102 102 102),
     HOVER-BACKCOLOR=RGB(218 225 232),
     BORDER-COLOR='WHITE',
$
TYPE=REPORT,
     OBJECT=STATUS-AREA,
     COLOR='WHITE',
     BACKCOLOR=RGB(102 102 102),
$
TYPE=REPORT,
     OBJECT=CURRENT-ROW,
     HOVER-BACKCOLOR=RGB(218 225 232),
     BACKCOLOR=RGB(200 200 200),
$
TYPE=REPORT,
     OBJECT=CALC-AREA,
     COLOR='WHITE',
     BACKCOLOR=RGB(102 102 102),
$
ENDSTYLE
END]]></request></requests></rootxmlnode></script>
</xml></BODY>
<script id=IBI_loader type=text/javascript>
doBeforeLoad();
</SCRIPT>
</HTML>



WF 8.1.05 Windows
January 31, 2013, 10:21 AM
paulI
Thank you for the replys. I will need to get back to this at a later time as my priorities have shifted. I will respond back when I get back to it. Thank you again.


Prod: WF 7.7.05, BID, MRE, 7.7.06M Server, Windows 2008, RedHat, Oracle 11gR1, MS Office 2010
Test: I wish we had one!