hi,i need some guide..
i have a form for leave application...its using CF v3
and this is the view code using chronoconnectivity
How can i filter it for only login user can view his/her data...i already use the mysql..but it wont work...can sum1 show me...thank u.
i have a form for leave application...its using CF v3
<div class="form_item">
<div class="form_element cf_heading">
<h3 class="cf_text">Leave Application Form</h3>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Staff ID</label>
<input class="cf_inputbox validate-number" maxlength="150" size="30" title="" id="text_3" name="staff_id" type="text" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Name</label>
<input class="cf_inputbox validate-alpha" maxlength="150" size="30" title="" id="text_4" name="name_id" type="text" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Email</label>
<input class="cf_inputbox validate-email" maxlength="150" size="30" title="" id="text_8" name="email_id" type="text" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label" style="width: 150px;">Leave Type</label>
<select class="cf_inputbox" id="select_5" size="1" title="" name="L_leavetype_id">
<option value="">Select Type</option>
<option value="Annual Leave">Annual Leave</option>
<option value="Medical Leave">Medical Leave</option>
<option value="Unplanned Leave">Unplanned Leave</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;">From Date</label>
<input class="cf_datetime" title="" size="20" id="L_datefrom_id" name="L_datefrom_id" type="text" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_datetimepicker">
<label class="cf_label" style="width: 150px;">To Date</label>
<input class="cf_datetime" title="" size="20" id="L_dateto_id" name="L_dateto_id" type="text" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Total Days Applied</label>
<input class="cf_inputbox validate-number" maxlength="150" size="30" title="" id="text_9" name="L_totaldaysapplied_id" type="text" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Contact No.</label>
<input class="cf_inputbox validate-number" maxlength="150" size="30" title="" id="text_11" name="L_contactno_id" 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;">Reason(s)</label>
<textarea class="cf_inputbox" rows="3" id="text_13" title="" cols="30" name="L_reason_id"></textarea>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textarea">
<label class="cf_label" style="width: 150px;">Address</label>
<textarea class="cf_inputbox" rows="3" id="text_16" title="" cols="30" name="L_address_id"></textarea>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_fileupload">
<label class="cf_label" style="width: 150px;">Upload file(s)</label>
<input class="cf_fileinput cf_inputbox" title="" size="20" id="file_17" name="L_upload_id" type="file" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_heading">
<h4 class="cf_text">Project Manager Details</h4>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label" style="width: 150px;">Project Manager</label>
<select class="cf_inputbox" id="select_19" size="1" title="" name="L_pm_id">
<option value="">Select PM</option>
<option value="Mr X">Mr X</option>
<option value="Mr Y">Mr Y</option>
</select>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">PM email</label>
<input class="cf_inputbox validate-email" maxlength="150" size="30" title="" id="text_20" name="L_pmemail_id" type="text" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_button">
<input value="Submit" name="button_21" type="submit" />
</div>
<div class="cfclear"> </div>
</div>
and this is the view code using chronoconnectivity
<html>
<title>Review Leave Status</title>
<style type="text/css">
.myTable { background-color:#FFFFE0;border-collapse:collapse; }
.myTable th { background-color:#BDB76B;color:white; }
.myTable td, .myTable th { padding:5px;border:1px solid #BDB76B; }
</style>
</head>
<body>
<table class="myTable">
<tr><td>Staff ID :</td><td> <strong>{staff_id}</strong></td><br></tr>
<tr><td>Name :</td><td> <strong>{name_id}</strong></td></tr>
<tr><td>Email </td><td> <strong>{email_id}</strong></td><br></tr>
<tr><td>Start Date :</td><td> <strong>{L_datefrom_id}</strong></td></tr>
<tr><td>End Date :</td><td> <strong>{L_dateto_id}</strong></td><br></tr>
<tr><td>Total Days Applied :</td><td> <strong>{L_totaldaysapplied_id}</strong></td></tr>
<tr><td>Total Leave Balance :</td><td> <strong>{L_totalavailable_id}</strong></td><br></tr>
<tr><td>Current Balance :</td><td> <strong>{L_currentbalance_id}</strong></td><br></tr>
<tr><td>Contact No. :</td><td> <strong>{L_contactno_id}</strong></td></tr>
<tr><td>Project Manager Email :</td><td> <strong>{L_pmemail_id}</strong></td><br></tr>
<tr><td>Upload File(s) :</td><td> <strong>{L_upload_id}</strong></td></tr>
<tr><td>Reason:</td><td> <strong>{L_reason_id}</strong></td><br></tr>
<tr><td>Address :</td><td> <strong>{L_address_id}</strong></td></tr>
<tr><td>Leave Type :</td><td> <strong>{L_leavetype_id}</strong></td><br></tr>
<tr><td>Approver :</td><td> <strong>{L_pm_id}</strong></td></tr>
</table>
</body>
</html>
How can i filter it for only login user can view his/her data...i already use the mysql..but it wont work...can sum1 show me...thank u.
Hi kayrie,
In the ChronoConnectivity WHERE box you need to include
Replace cf_user_id with the column name of the user id in your table. You may also need to alter this if you have other filters in the WHERE box.
Bob
In the ChronoConnectivity WHERE box you need to include
<?php
$user =& JFactory::getUser();
echo " WHERE `cf_user_id` = '{$user->id}' ";
?>Replace cf_user_id with the column name of the user id in your table. You may also need to alter this if you have other filters in the WHERE box.
Bob
hi bob,
about the edit and new record button below it...
when i edit....and save...it will become a new record...
how can i edit only certain value and save it with overwriting it
about the edit and new record button below it...
when i edit....and save...it will become a new record...
how can i edit only certain value and save it with overwriting it
Hi kayrie,
Make sure that you include the current primary key value (usually cf_id) in the form as a hidden input.
Bob
Make sure that you include the current primary key value (usually cf_id) in the form as a hidden input.
Bob
Hi Kayrie,
Assuming that the data is being auto-loaded and your table primary key is cf_id you need to add this to the Form HTML
The value should then be sutomatically set to the value of the record you are editing.
Bob
Assuming that the data is being auto-loaded and your table primary key is cf_id you need to add this to the Form HTML
<input type='hidden' name='cf_id' id='cf_id' value='' /> The value should then be sutomatically set to the value of the record you are editing.
Bob
Sorry bob, but still did not get it.
If in form html i have a code like this one
Thank You for reply😉
If in form html i have a code like this one
<div class="form_item">
<div class="form_element cf_textarea">
<label class="cf_label" style="width: 150px;">Permanent Address</label>
<textarea class="cf_inputbox" rows="5" id="text_21" title="" cols="30" name="permentadd_id"></textarea>
</div>
<div class="cfclear"> </div>
</div>
How did i want to add the code as ur mention?Thank You for reply😉
Hi kayrie,
I'm not sure how else to explain it. Try copying and pasting the code I gave you into the Form HTML box.
Bob
I'm not sure how else to explain it. Try copying and pasting the code I gave you into the Form HTML box.
Bob
i assume we discuss under chronoform right?
This because as ur mention to paste inside Form HTML box that can be find inside chronoform.
Actually i'm still did not get it.
Sowie ;(
Thank You 4 reply😉
This because as ur mention to paste inside Form HTML box that can be find inside chronoform.
Actually i'm still did not get it.
Sowie ;(
Thank You 4 reply😉
Hye bob,
What ur said i get it, but to insert it i'm little bit confuse.
This because in my FORM HTML box have a code that generate based on what i design previously from form wizard.
The code :
Thus where i have to insert the code as ur mention inside it?
Thank you 4 reply😉
What ur said i get it, but to insert it i'm little bit confuse.
This because in my FORM HTML box have a code that generate based on what i design previously from form wizard.
The code :
<div class="form_item">
<div class="form_element cf_textarea">
<label class="cf_label" style="width: 150px;">Contact Address</label>
<textarea class="cf_inputbox" rows="5" id="text_20" title="" cols="30" name="contactaddress_id"></textarea>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textarea">
<label class="cf_label" style="width: 150px;">Permanent Address</label>
<textarea class="cf_inputbox" rows="5" id="text_21" title="" cols="30" name="permentadd_id"></textarea>
</div>
<div class="cfclear"> </div>
</div>Thus where i have to insert the code as ur mention inside it?
Thank you 4 reply😉
Thank you reply bob.
Can your show just one example how to insert it?
Really appreciate it😉
Can your show just one example how to insert it?
Really appreciate it😉
Hi Kayrie,
There is nothing else to say. Copy and paste it into the Form HTML box.
Bob
There is nothing else to say. Copy and paste it into the Form HTML box.
Bob
Hi Bob,
Thank 4 reply😉
Actually i'm have another question to ask you.
Does chronoconnectivity can add a submit button?
I know we can edit/delete or create new inside it.
But the submit button i mention that is when user view their data at the bottom have a button that can be click on and that botton directly submit the data inside database without have to edit it use edit link provided in.
Thank You😉
Thank 4 reply😉
Actually i'm have another question to ask you.
Does chronoconnectivity can add a submit button?
I know we can edit/delete or create new inside it.
But the submit button i mention that is when user view their data at the bottom have a button that can be click on and that botton directly submit the data inside database without have to edit it use edit link provided in.
Thank You😉
Hi Kayrie,
If you ae viewing details then you are probably doing it in a ChronoForm, not in a ChronoConnectivity listing. You could add a submit button to a listing but it would take careful coding to make it work correctly and I doubt it is worth the time and trouble.
Bob
If you ae viewing details then you are probably doing it in a ChronoForm, not in a ChronoConnectivity listing. You could add a submit button to a listing but it would take careful coding to make it work correctly and I doubt it is worth the time and trouble.
Bob
Hye bob,
Just wanna asking you. Can i combine two form in one table that when the data submitted both data from two form is in one row. Because i succeed create two form and it connected with one table. The problem is when i submitted data the data separate each other.
Thank you 4 reply😉
Just wanna asking you. Can i combine two form in one table that when the data submitted both data from two form is in one row. Because i succeed create two form and it connected with one table. The problem is when i submitted data the data separate each other.
Thank you 4 reply😉
Hi Kayrie,
Yes sure. You need to make sure that the value of the Primary Key for the record is included in the form data. If there is an existing primary key then the record will be updated; if not a new record is added.
Bob
Yes sure. You need to make sure that the value of the Primary Key for the record is included in the form data. If there is an existing primary key then the record will be updated; if not a new record is added.
Bob
Thank you bob.
But where does i need to make both form have same primary key, where to configure it?
Thank You 4 reply😉
But where does i need to make both form have same primary key, where to configure it?
Thank You 4 reply😉
Hi kayrie ,
It's the database tables that have primary keys. You can check with PHPMyAdmin or the ChronoForms table editor/viewer.
Bob
It's the database tables that have primary keys. You can check with PHPMyAdmin or the ChronoForms table editor/viewer.
Bob
i've done that...
but its still make new record...
the data still separated each other....
i confuse on set up its primary key...this because when i submit the data it based on cf_id n else..
but its still make new record...
the data still separated each other....
i confuse on set up its primary key...this because when i submit the data it based on cf_id n else..
Hye bob,
Thank You for helping.
I do all you said and succeed.
Just to ask you, about this coding. Anything wrong with it? I gonna make a calculation inside a form so it can help user to compute amount their entered. Actually i new in learning basic programming. Really appreciate if you can help.
Thank You for helping.
I do all you said and succeed.
Just to ask you, about this coding. Anything wrong with it? I gonna make a calculation inside a form so it can help user to compute amount their entered. Actually i new in learning basic programming. Really appreciate if you can help.
<?php
$script = "
window.addEvent('domready', function() {
function calculate() {
var value1 = $('value1').value;
var value2 = $('value2').value;
var value3 = $('value3').value;
var value4 = $('value4').value;
var value5 = $('value5').value;
var total = ( value1 + value2 + value3 + value4 + value5);
// Check that the result is a finite number. If so, display the results.
if (!isNaN(monthly) &&
(monthly != Number.POSITIVE_INFINITY) &&
(monthly != Number.NEGATIVE_INFINITY)) {
total.value = round(value1 +value2 +value3 +value4 + value5);
} else {
// Otherwise, the user's input was probably invalid, so don't
// display anything.
total.value = '';
}
}
// rounds number to two decimal places.
function round(x) {
return Math.round(x*100)/100;
}
$('compute').addEvent('click', calculate );
$('value1').addEvent('change', calculate );
$('value2').addEvent('change', calculate );
$('value3').addEvent('change', calculate );
$('value4').addEvent('change', calculate );
$('value5').addEvent('change', calculate );
});
";
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration($script);
?>
<table>
<tr><td colspan="3"><b>Enter Amount Information:</b></td></tr>
<tr>
<td>1)</td>
<td>Amount of the 1 :</td>
<td><input type="text" name="value1" id="value1" size="12" ></td>
</tr>
<tr>
<td>2)</td>
<td>Amount of the 2 :</td>
<td><input type="text" name="value2" id="value2" size="12" ></td>
</tr>
<tr>
<td>3)</td>
<td>Amount of the 3 :</td>
<td><input type="text" name="value3" id="value3" size="12" ></td>
</tr>
<tr>
<td>4)</td>
<td>Amount of the 4 :</td>
<td><input type="text" name="value4" id="value4" size="12" ></td>
</tr>
<tr>
<td>5)</td>
<td>Amount of the 5 :</td>
<td><input type="text" name="value5" id="value5" size="12" ></td>
</tr>
<tr><td colspan="3">
<input type="button" value="Compute" id='compute' " >
</td></tr>
<tr><td colspan="3">
<b>Payment Information:</b>
</td></tr>
<tr>
<td>5)</td>
<td>Your total will be:</td>
<td><input type="text" name="total" id="total" size="12" readonly='readonly'></td>
</tr>
</table>
Hi kayrie,
This line doesn't do what you intend
Bob
This line doesn't do what you intend
total.value = round(value1 +value2 +value3 +value4 + value5);You need to add an input with id='total' and change this to $('total').value = round(value1 +value2 +value3 +value4 + value5);Bob
Hye bob,
thank you for reply.
But i'm still cannot get the total value.
It does not came up any value when i'm press compute.
thank you for reply.
But i'm still cannot get the total value.
It does not came up any value when i'm press compute.
This topic is locked and no more replies can be posted.
