Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hello All,

Is it possible to check if a page with the same name exists with a data bound form?

For Example:
if there is a DBF that has a page named a_b_c and someone again tries to create a page with the same name, can that page be stopped from being created?

I could not explain it better! :(

Regards,
GenXCoders
Image
where innovation meets technology
@KK Sir,
I went through it. But couldnot understandhow to implement it.

My method of implementation is:
1. There is a template for student, months and fee-payment. All are clonable.
2. I am getting data of students and months into fee-payment without using relations.
3. Using the fee-payment i am saving the payment received as studentid_monthid_year (where id is actually k_page_id).

Now i am wanting to achieve:
1. Show all unrelated pages (month names) for which fee-payment is not received

OR

2. Show months in the fee-payment checking if for a student for the month the fee-payment exists or not. If it exists show some error or even better not display the month in the fee-payment form.

What should i do? Please guide.

Regards,
GenXCoders
Image
where innovation meets technology
Hello Ashish Sir.

Below i am sharing code from mitalock's portal where client needs to check it attendance for that date exist. If that exist then it will show that data... if that day attendance is not submitted. It will return
a line saying that attendance not found and a link to check other date.

File is public_html/...portal/attendance/check.php i can share code with you.


As of now. Take a look at the code itself.

Code: Select all
<cms:form method="post">


    <cms:if k_error >
        <h3>Failed to submit form</h3>
        <cms:each k_error >
            <cms:show item /><br>
        </cms:each>
    </cms:if>

  <section class="section">
    <div class="container">

<cms:if k_success >
<cms:set my_search_term="<cms:show frm_select />" />

<cms:if my_search_term != '' >
    <cms:set my_page_exists="<cms:pages masterpage='attendance/index.php' page_title=my_search_term limit='1' count_only='1' />" />
</cms:if>

<cms:if my_page_exists >
    <cms:pages masterpage="attendance/index.php" custom_field="att_date==<cms:show frm_select />">
<h1 class="title">
       Attendance
      </h1>
      <p class="subtitle">
        Date : <cms:show frm_select />
      </p>



<table class="table is-bordered is-striped is-narrow is-hoverable is-fullwidth">
  <thead>
    <tr>
        <th colspan="2">Staff Attendance</th>
    </tr>
  <tr>
    <td><b>Name</b></td>
    <td><b>Attendance</b></td>
  </tr>
</thead>
<tbody>
<cms:each employees sep='|' >
    <tr>
      <td><cms:show item /></td>
      <td><cms:get "att_<cms:show item />" /></td>
    </tr>
</cms:each>
</tbody></table>

<br>
<br>
<cms:set msg ="<cms:show departments />" />
<cms:each msg sep='|' >
<!-- starting of Tables -->
<table class="table is-bordered is-striped is-narrow is-hoverable is-fullwidth">
  <thead>
  <tr>
    <th><cms:show item /></th>
    <th>In Time</th>
    <th>Out Time</th>
    <th>W. Hr</th>
    <th>Amount</th>
  </tr>
  </thead>

  <tbody>
    <cms:pages masterpage="emp/index.php" order="asc" custom_field="emp_department==<cms:show item /> | emp_status==Active">
    <tr>
            <td><cms:show emp_firstname /> <cms:show emp_lastname /></td>
            <td><cms:get "att_uid_<cms:show emp_id />_in" /></td>
            <td><cms:get "att_uid_<cms:show emp_id />_out" /></td>
            <cms:set emp_work_hr="<cms:sub "<cms:get "att_uid_<cms:show emp_id />_out" />" "<cms:get "att_uid_<cms:show emp_id />_in" />" />" />

            <td>
            <cms:set emp_acc_workinghr="<cms:sub "<cms:sub "<cms:get "att_uid_<cms:show emp_id />_out" />" '0.5' />" "<cms:get "att_uid_<cms:show emp_id />_in" />" />" />

            <cms:if emp_work_hr=='0'>
            0
            <cms:else />
            <cms:show emp_acc_workinghr /> Hr.
            </cms:if>

            <cms:set emp_rate_perhr="<cms:div emp_rate '8' />" />
            </td>

            <td>
            <cms:if emp_work_hr=='0'>
            0
            <cms:else />
            <cms:set emp_work_hr_amount="<cms:mul emp_acc_workinghr emp_rate_perhr />" />
            <cms:php>echo(round("<cms:show emp_work_hr_amount />") . "<br>");</cms:php>
            </cms:if>
            </td>
    </tr>
    </cms:pages>
  </tbody>
</table>
<!-- Tables Closed -->
</cms:each>

<center><a class="button is-link is-rounded" href="<cms:show k_site_link />attendance/check.php">View Other</a> </center>
</cms:pages>

<cms:else />
   <center>Attendance Not Found <br>
   for <strong> Dated : <cms:show frm_select /></strong>. <br><br><a class="button is-link is-rounded" href="<cms:show k_site_link />attendance/check.php">View Other</a> </center>

</cms:if>


<cms:else />
<section class="section">
<center>
<div class="box">
<h1 class="title">Attendance</h1>
<h2 class="subtitle">Select Date</h2>   <br>
<div class="select is-rounded"><cms:input name="select" opt_values="<cms:embed 'datetime.htm' />"  dynamic='opt_values'  type='dropdown'   group='event_sensei' /></div>
<br><br><button class="button" type="submit">Submit</button>
</div>
</center>
</section>
</cms:if>
</div>
</section>
</cms:form>


If you still need any help. We are here, always.

Thanks @kk sir for Couch.

Love & Peace.

Manu Choudhary,
info[at]gurujicorp[dot]com or gurujicorporation[at]gmail[dot]com
4 posts Page 1 of 1