Home » Fusion Middleware & Colab Suite » Weblogic & Application Server » Need help on htp.formSelectOption
Need help on htp.formSelectOption [message #367398] Thu, 26 October 2000 08:29 Go to next message
Gautam Sarkar
Messages: 1
Registered: October 2000
Junior Member
There are two drop-down list box in a form. I need to catch the selected value from first drop-down list box before Submit.

Here is my coding :-

begin
htp.formOpen(owa_util.get_owa_service_path ||
'package_name.procedure_name');
htp.formSelectOpen('dept_no', 'Department', 1);
for i in (select DEPT_NO, DEPT_NAME
from DEPT
order by DEPT_NAME)
loop
htp.formSelectOption(i.DEPT_NAME,
cselected=>'TRUE',
cattributes=>'value='||
i.DEPT_NO);
end loop;
htp.formselectclose;

htp.formSelectOpen('emp_no', 'Employee', 1);
for i in (select EMP_NO, ENAME
from EMP
where DEPT_NO = SELECTED VALUE FROM
FIRST DROP DOWN
LIST BOX
order by ENAME)
loop
htp.formSelectOption(i.ENAME, cselected=>'TRUE',
cattributes=>'value='||
i.EMP_NO);
end loop;
htp.formselectclose;

htp.formsubmit(cvalue=>'Go');
htp.formclose;
end;

Actually the user will select the department first.
Then Employee will be selected according to the
Department. I need both the selection in one page.

I need help.

Thanks

Gautam
Re: Need help on htp.formSelectOption [message #367399 is a reply to message #367398] Fri, 27 October 2000 13:36 Go to previous messageGo to next message
Prem
Messages: 79
Registered: August 1998
Member
Gautam,

Looks like i m missing something here. When the page is generated, if both these lists belong to the same page, how can the user choose the department before the employee list is even created?

If all you need is to get the value of the list item chosen before submit, then you can use javascript in onSubmit method for form tag and do any of your validations. If you want to display all employees for a selected departments, then you can have both these lists on different frames and refresh the other list depending on the selection. Are these one of your requirements or is it that i m blabbering on something totally unrelated? :)

Prem :)
Re: Need help on htp.formSelectOption [message #367400 is a reply to message #367398] Mon, 30 October 2000 15:16 Go to previous messageGo to next message
Ryan Dorosh
Messages: 12
Registered: October 2000
Junior Member
If I understand this correctly, the way I'd do this (and assuming you don't have thousands of employees) is I'd write a javascript array to the HTML page. Upon the department being selected it'd call a javascript function that populates the second select with the names of the employees for that department. The second method is to call the server to rewrite the page when a new department is selected, which would then have the employee select filled in. The third option is the like the second but using frames (which i hate). Very simple to do. If you need more help or sample code please write me back.
Re: Need help on htp.formSelectOption [message #367402 is a reply to message #367400] Tue, 31 October 2000 14:41 Go to previous message
Ryan Dorosh
Messages: 12
Registered: October 2000
Junior Member
The select will call a javascript function which will call the server with
the appropiate information to request a new page, with the filled in
employee select.

I think it'd look something like this.

<html>

<javascript>

function myRedirectFunction()
{

location.href="/server/somedirectory/mypackage.myproc?department="+myform.de
partment.value();
}

<body>
<form name="myform">
<select department onChange="myRedirectFunction()">

</body>

</html>

You'll have to make sure that "myform.department.value()" extracts the
value
of the department select. I could be wrong with the jscript function.

Let me know if this works. By the way, this will refresh the page everytime
someone changes the department. You might want an 'ok' button for them to
click when they want the page to refresh.
Previous Topic: Can WedDB do these things for me?
Next Topic: OAS, 8i, Forms Deployment
Goto Forum:
  


Current Time: Sun Sep 19 00:45:36 CDT 2021