Post job opening

In this section of the tutorial, you will build the page that will allow companies post a new job opening on the site. It is basically an insert operation, but one that will be improved with the help of better form controls - MX Widgets.

To create the new job posting page, follow the next steps:

  1. Open the company/post_job page in Dreamweaver.
  2. The job posting is actually an insert operation in the job_job table, which stores various details regarding the offer, some columns as direct text / numeric values, and some are just foreign keys to other tables - some of them editable, and some not (e.g. the company ID is not editable, while the job location or domain is) - that need to be retrieved.
  3. The only non-editable foreign key - the company ID - must be passed to the table column behind the scenes, without displaying anything to the user. To achieve this, you must retrieve it before creating the insert form, from the company_com table.
  4. The way to retrieve the company ID is to use a filtered recordset, based on the company's associated user ID. This is stored as foreign key in the company_com table, but exists also as a session variable (the company must be logged in before posting an offer). Create a new recordset from the Bindings tab, that uses the company_com table, and filters the records based on the kt_login_id session variable, as shown below:


                                
  5. Now you can start creating the actual offer posting form, with the use of the Insert Record Form Wizard. You can access this wizard from the MX Kollection tab of the Insert Panel.
  6. For the first step, configure it to use your specific database connection (the one defined at the beginning of this tutorial) and table (e.g. the job_job table). For the page to open after the insert operation is successful, use the Browse button to select the company/index file:


                                 
  7. Once you're done with the general options for the wizard, you can move on to the second step, where you will have to set the properties for each field. To modify the settings for a field, select it from the Form fields grid, and then use the Display as and Submit as drop-down menus to set the respective properties. Depending on the selected Display as option, some additional elements can become visible on page (e.g. for menu, the Menu Properties and Add recordset button).
  8. For the job's table columns, set the following properties:
  9. Click the Finish button to add the HTML form and the insert record server behavior into the page.

    Note:
    If you are using a Microsoft Access database, in the Submit as drop-down menu, for the deadline_job field, another option will be available: Date MS Access. Select this option when submitting the date.


         

In Dreamweaver you have to remove the user ID row from the form, as it must not show up on page:

 


 

 

At this point, the job offer posting page works as intended, but can be greatly improved - the deadline can be selected visually from a calendar, the domain list could be increased, by allowing a company define its domain, or restrict the number for salary to positive integers - with the help of more advanced form controls.

The way to enhance these standard HTML form elements, is to replace them with MX Widgets form controls:

 

The first element to be enhanced is the Job domain drop-down menu. The reason is that the site's administrator cannot add all job domains; therefore, if a company wants to post a job add in a domain that doesn't exist in the database, it should be able to do it. The form control that allows this kind of behavior is the  MX Widget Editable drop-down.

To enhance this field, follow the instructions below:

  1. Select the Job domain drop-down menu in the Dreamweaver editable area.
  2. Apply the Editable Drop-down server behavior. You can access it from Server Behaviors -> MX Kollection -> Form Controls.
  3. Configure the dialog box that opens. The recordset name, labels and values field are already set, because the menu was already dynamic, from the wizard. You just need to set some more advanced options:
    · The number of records to be displayed when the menu is opened. The menu contains all records from the recordset, but only a limited number is displayed, for performance reasons.
    · The Single click select checkbox allows the user to click only once to select an item.
    · In the Restrict to list elements drop-down menu, select NO, as this will allow the addition of new elements. Leave the rest of the options at their default values, and click on OK to apply the server behavior:



    Note:
    If you use this server behavior on the ColdFusion server model, a file named Application.cfm will be automatically generated in the site root folder. Do not delete this file, as it contains settings related to session variables used by the server behavior and the current application. If you remove this file or modify it, application pages that use sessions will not function properly.
 

Next comes the deadline field. To ease the way users enter the dates, and to make sure they do not enter anything wrong, this simple text-field will be replaced by the Date Picker control. Follow the instructions below to enhance this HTML form element:

  1. Select the deadline text-box in Dreamweaver's editable area.
  2. Apply the Date Picker server behavior. You can access it from the Server Behaviors -> MX Kollection -> Form Controls.
  3. The default options are enough for this page, so you can just click the OK button to replace the text-box.



    Note:
    In addition to the date picker interface, the date format can also be changed from the InterAKT Control Panel, under Date formats.
 

The next field to change to a widget is the salary one. In order to prevent bad input (e.g. characters, negative values, etc) you should apply the Numeric Textfield Widget on this field.  You can access it from the Server Behaviors tab > + > MX Kollection > Form Controls, and you do not need to configure anything: the default settings are good:

 

 

The last form field to enhance is the job details text area. You will replace it with the Restricted Text Area control. Simply select the text area in Dreamweaver's editable area, and apply the Restricted Text Area server behavior from Server Behaviors -> MX Kollection -> Form controls. Set a maximum number of characters, and check the Show character count checkbox:

 

Now you can save the page in the browser and upload it to the server. To check it out, first log in with a company account, and then point your browser to the Post Job section. Fill in the form, using the enhanced controls, and upon submitting, all users will be able to see it:
 

 

In the next section of the tutorial you will create a page that allows companies see who applied for a position.