Forums

Editing forms data in the backend

irti 22 Feb, 2010
Hi
I wanted to know of there is anyway to edit form data in the backend without having to go into the database. For example if a user fills a request form....is there anyway to associate a field with that form like a request work order, which doesn't come up on the forms page(for the user) but i should be able to fill in that field in the backend and save...??? Thanks a lot.
GreyHead 22 Feb, 2010
Hi irti,

No easy way to do it in the backend, but it's simple enough in the front-end. Create a version of the form with the extra field, preload it with the data (editable or just for display) and make that version of the form (or just the extra field) display only for admins.

If you have the cf_id (or the table primary key) in a hidden field then ChronoForms will update the table instead of adding a new record.

Bob

PS You could also do this with ChronoConnectivity to show a list of records.
irti 22 Feb, 2010
Brilliant....am working it out now...so actually i can copy the same form with the same tables ...just in one form i don't put the fields in the front end and in the other one i add extra fields which the admin is supposed to fill out.......am i right????? its wonderful how you make everything seem so simple!!
irti 22 Feb, 2010
Hi....Could you please tell me how to add that cf_id as a hidden field.........thanks a lot i think its working...just need to test it out using the cf_id......
irti 22 Feb, 2010
Hi Greyhead...i know am a constant source of disturbance to you...but i have just reached a big time stumbling block.....ok here is the deal

I want to create a form which is editable by 4 categories of people....the normal user...a help desk user...the technician....and the supervisor..ok so the user shouldn't be able to see the fields which the help desk has to edit..the help desk shouldn't see what the engineer has to fill out..and so on..So i made a form...copied it 3 times...in the 1st copy of the form i added the extra fields for the help desk..in the second copy of the form i added the fields for the engineer and in the 3rd copy i added extra fields for the supervisor...but then when i click on the form for the supervisor it only shows me the fields for the user..not the extra fields for the supervisor....i am pasting the html code here......it would be great if you could help me out with this..
One more thing...i created an initial table for the first form...then connected the rest of the forms to this table....and then from the table manager i added the extra fields...pls tell me how should i go about doing this...thanks a lot for your much needed help!!!!

<div class="form_item">
  <div class="form_element cf_heading">
    <h4 class="cf_text">Work Requisition Form</h4>
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_heading">
    <h5 class="cf_text">Hospital Engineering Department</h5>
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;">Department</label>
    <select class="cf_inputbox validate-selection" id="select_0" size="1" title=""  name="department">
    <option value="">Choose Option</option>
      <option value="Executive Office">Executive Office</option>
<option value="Quality Improvement">Quality Improvement</option>
<option value="Operations">Operations</option>
<option value="Front office & Billing">Front office & Billing</option>
<option value="Patient Care Services">Patient Care Services</option>
<option value="Insurance Department">Insurance Department</option>
<option value="Finanace & Accounts">Finanace & Accounts</option>
<option value="Human Resources">Human Resources</option>
<option value="Materials">Materials</option>
<option value="Marketing">Marketing</option>
<option value="Medical Records">Medical Records</option>
<option value="Nursing Admin">Nursing Admin</option>
<option value="Operation Theatre">Operation Theatre</option>
<option value="Intensive Care Unit">Intensive Care Unit</option>
<option value="Emergency">Emergency</option>
<option value="VIP Suite">VIP Suite</option>
<option value="Maternity">Maternity</option>
<option value="Out Patient Department">Out Patient Department</option>
<option value="Medical Transcriptionist">Medical Transcriptionist</option>
<option value="Hospital Engineering">Hospital Engineering</option>
<option value="Obs and Gynaecology">Obs and Gynaecology</option>
<option value="Pediatrics">Pediatrics</option>
<option value="Internal Medicine">Internal Medicine</option>
<option value="Cardiology">Cardiology</option>
<option value="Orthopedics">Orthopedics</option>
<option value="Radiology">Radiology</option>
<option value="Laboratory">Laboratory</option>
<option value="Anaesthesia">Anaesthesia</option>
<option value="Dental & Orthodontics">Dental & Orthodontics</option>
<option value="Opthalmology">Opthalmology</option>
<option value="ENT">ENT</option>
<option value="General Surgery">General Surgery</option>
<option value="Dermatology & Plastic Surgery">Dermatology & Plastic Surgery</option>
<option value="General Practitioners">General Practitioners</option>
<option value="Physiotherapy">Physiotherapy</option>
<option value="Pharmacy">Pharmacy</option>
<option value="CSSD">CSSD</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 300px;">Room No. (if applicable)</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="text_4" name="room_number" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;">Work Type</label>
    <select class="cf_inputbox validate-selection" id="select_5" size="1" title=""  name="work_type">
    <option value="">Choose Option</option>
      <option value="Critical">Critical</option>
<option value="Normal">Normal</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_multiholder" style="margin-left:0px!important;">
  	<label class="cf_label" style="width: 300px;">Nature of Work</label>
    <table cellspacing="0" cellpadding="0" width="95%" title="" class="multi_container">
        <tbody width="100%">
            <tr width="100%">
                <td style="width: auto; vertical-align: middle; text-align: left;">
<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 50px;">MEP</label>
    <select class="cf_inputbox validate-selection" id="select_6" size="1" title=""  name="mep">
    <option value="">Choose Option</option>
      <option value="Electrical">Electrical</option>
<option value="Plumbing">Plumbing</option>
<option value="A/C">A/C</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>
</td>
<td style="width: auto; vertical-align: middle; text-align: left;">
<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 50px;">Civil</label>
    <select class="cf_inputbox" id="select_7" size="1" title=""  name="Civil">
    <option value="">Choose Option</option>
      <option value="Carpentry">Carpentry</option>
<option value="Painting">Painting</option>
<option value="Other">Other</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>
</td>
<td style="width: auto; vertical-align: middle; text-align: left;">
<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 75px;">Tailoring</label>
    <select class="cf_inputbox" id="select_8" size="1" title=""  name="tailoring">
    <option value="">Choose Option</option>
      <option value="New Request">New Request</option>
<option value="Alteration">Alteration</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>
</td>
<td style="width: auto; vertical-align: middle; text-align: left;">
<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 80px;">Biomedical (Asset No.)</label>
    <input class="cf_inputbox" maxlength="15" size="15" title="" id="text_9" name="biomedical_asset_number" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>
</td>

            </tr>
        </tbody>
    </table>
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textarea">
    <label class="cf_label" style="width: 300px;">Work Details</label>
    <textarea class="cf_inputbox" rows="3" id="text_0" title="" cols="30" name="work_details"></textarea>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 300px;">Requestor Name</label>
    <input class="cf_inputbox required" maxlength="150" size="30" title="" id="text_1" name="requestor_name" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 300px;">Approved by</label>
    <input class="cf_inputbox required" maxlength="150" size="30" title="" id="text_2" name="approved_by" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">To be filled by the Help Desk</span> </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_datetimepicker">
    <label class="cf_label" style="width: 300px;">Date</label>
    <input class="cf_datetime required" title="" size="20" id="date_of recieving" name="date_of recieving" type="text" />
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 300px;">Time</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="text_17" name="time_of_recieving" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 300px;">Assigned to</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="text_18" name="assigned_to" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">To be filled by te Engineer/Technician</span> </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">Work Attended</span> </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_datetimepicker">
    <label class="cf_label" style="width: 300px;">Date</label>
    <input class="cf_datetime" title="" size="20" id="date_of_notification" name="date_of_notification" type="text" />
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 300px;">Time of Notification</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="text_3" name="time_of_notification" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;">Job Status</label>
    <select class="cf_inputbox validate-selection" id="select_4" size="1" title=""  name="job_status">
    <option value="">Choose Option</option>
      <option value="Completed">Completed</option>
<option value="Pending">Pending</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_datetimepicker">
    <label class="cf_label" style="width: 150px;">Date (if completed)</label>
    <input class="cf_datetime" title="" size="20" id="date_completed" name="date_completed" type="text" />
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 300px;">Time (if completed)</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="text_6" name="time_completed" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textarea">
    <label class="cf_label" style="width: 150px;">Action Taken</label>
    <textarea class="cf_inputbox" rows="3" id="text_7" title="" cols="30" name="action_taken"></textarea>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">To be verified by the Work Supervisor</span> </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textarea">
    <label class="cf_label" style="width: 300px;">Remarks</label>
    <textarea class="cf_inputbox" rows="3" id="text_27" title="" cols="30" name="remarks"></textarea>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_button">
    <input value="Submit" name="button_3" type="submit" /><input type="reset" name="reset" value="Reset"/>
  </div>
  <div class="cfclear"> </div>
</div>
GreyHead 22 Feb, 2010
Hi irti,

You are getting into developing an application here. There's not a lot of help that I can give.

I woudl only use one form (having 3-4 makes maintenance much more difficult). Check the User Id / User Group at the beginning and then use PHP to show the appropriate fields.

Provided you include the cf_id in the form as a hidden field then ChronoForms will update the previous record when the form is submitted.

Bob
irti 22 Feb, 2010
hmmmmmm......so i would have to create user groups and tag those particular fields as editable by some particular user group...that sounds smart compared to what i was doing...thanx a lot....if its not too much of a bother could i ask you to please give me a head start as to how i should go about doing this.....thanks once again for your help.....wanted to ask you one more thing..i am looking at chronoforms as a data entry solution to an intranet (i will obviously buy the unlimited solution for both chronoforms and chronoconnectivity..this is just a testing phase to see how everything works out).....means a lot of table relationships...i am working in a hospital..so the amount of data will be huge...what do you recommend???
GreyHead 22 Feb, 2010
Hi irti,

Last question first. The amount of data shouldn't be a problem in itself - millions of records should be possible. The number of requests could be a problem but MySQL is fairly robust there too. If you have a lot of transcational traffic then record locking could be a problem - stopping two people updating the same record at the same time. That's out of my experience but can be handled and it should be possible to add the necessary code to ChronoForms.

Here's the simple version of a 'user group' handler.
<?php
$engineer_array = array ( '123', 134', '457');
$user = & Factory::getUser();
if ( in_array($user->id, $engineer_array) ) {
  $is_engineer = true;
}
// repeat for other groups
?>
. .  .
<?php
if ( $is_engineer ) {
?>
  // show some HTML
<?php
} else {
?>
  // show some other HTML
<?php
}
?>

In practice you might well put the group info into a database table and load it from there instead of a hard-coded array but the way it works is the same.

Bob
This topic is locked and no more replies can be posted.