Wednesday, 25 April 2012

ATG Forms Example

<dsp:form action="DoctorAppointment.jsp" method="post"
synchronized="/atg/droplet/DoctorAppointmentFormHandler">
  
  Patient Name: <dsp:input type="text"
   bean=" AppointmentDetails.patientName"/>

 Appointment Date: <dsp:input type="text"
   bean=" AppointmentDetails.appDate"/>
  


 Appointment Time: <dsp:select bean="AppointmentDetails.appTime">
    <dsp:option value="10.00am">10 am</dsp:option>
  
    <dsp:option value="10.15am">10.15 am</dsp:option>
  
    <dsp:option value="10.30am">10.30 am</dsp:option>
  
    <dsp:option value="10.45am">10.45 am</dsp:option>
  
    <dsp:option value="11.00am">11 am</dsp:option>
  
   </dsp:select>

  Gender:
     <dsp:input type=radio bean=" AppointmentDetails.gender"
      value="male">Male</dsp:input>
     
 <dsp:input type=radio bean=" AppointmentDetails.gender"
      value="female"/>Female</dsp:input>
  <dsp:input type="submit" value="Create Appointment"
   bean=" DoctorAppointmentFormHandler.create"/>
</dsp:form>

The above example demonstrates a form for booking a doctor appointment online. Using this form, a user can specify:

· Patient Details

· Appointment Time

· Appointment Date

When a user clicks Create Appointment, the data entered in the form is saved to the DoctorAppointmentFormHandler and authorized, and basic Form handler validation are done and saved to the database if the user has enetered a valid data, the formhandler returns error message for invalid data. since this example uses the post method, the form is pre-populated with the data last-saved to DoctorAppointmentFormHandler.