If you could spare me a moment: I have tried to work on this and the
javascript just won't address the right text input box.
So:
how do I emulate the following html and javascript with struts HTML tags?
Here is the script:
<SCRIPT LANGUAGE="JavaScript">
/// Airport City codes, for this SearchFares page ///
var airportListForm = "";
var airportListBox = "";
function openCityCodes(tbForm, tbBox) {
self.airportListForm = tbForm;
self.airportListBox = tbBox;
window.open('<%=request.getContextPath()%>/city_popper.html','CityCodes','wi
dth=400,height=415,resizable=yes');
}
function setAirportValue(airportCode) {
var box = eval("document." + airportListForm + "." +
airportListBox);
box.value = airportCode;
}
</SCRIPT>
Here is working HTML code with the Javascript:
<form name="mainform" id="mainform"
action="<%=request.getContextPath()%>/user/fares/displayFares.agent"
method="POST">
<tr>
<td valign=center>
<input type="text" name="departCity" size=30>
</td>
<td valign=center>
<a
href="javascript:openCityCodes('mainform','departCity');">
<img
src="<%=request.getContextPath()%>/images/icon_lookup.gif" width=30
height=17 border=0>
</a>
</td>
</tr>
etc...
So the form is mainform and the text input name is departCity. This works.
Here is NON functional struts code: the error is
'document.bookingForm.bookingBean.departureCityCode' is null or not an
object. The form bean for /pnr/add/booking is bookingForm so this is the
name of the form. I am sure of that. But the name of the text box doesn't
work apparently:
<html:form action="/pnr/add/booking.agent" method="POST">
<html:hidden property="PNRID"/>
<table border="0" cellpadding="0" cellspacing="0">
<td colspan="2">
<table cellpadding="1" width="100%"
border="0"><tr><td> </td><td>
<a name="Create"></a><span class="subheader">Create Booking</span>
<br>
<br>
<table border="0" width="100%" cellpadding="3" cellspacing="0">
<tr>
<td class="text">Departure City Code:</td>
<td>
<html:text property="bookingBean.departureCityCode"
maxlength="3" size="5"/>
<font color = "#FF0000"><html:errors
property="bookingBean.departureCity"/></font>
</td>
<td>
<a
href="javascript:openCityCodes('bookingForm','bookingBean.departureCityCode'
);">
<img
src="<%=request.getContextPath()%>/images/icon_lookup.gif" width=30
height=17 border=0>
</a>
</td>
</tr>
etc....
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>