Forum for discussing general topics related to Couch.
2 posts Page 1 of 1
I have made a form with some fields and one of them is FULLNAME.

I would like to FETCH the registered users in a dropdown for this FULLNAME field so everytime a fill out the form and store it i can select witch USER the data should belong to!

Today i have a file called new-absence.php and in this form is the fields and it is made with type BOUND form.

Anyone have some IDE how to do this, i did try some solutions but with big failure.

Code: Select all
<?php require_once( '../admin/cms.php' ); include 'header.php'; ?>
   
        <!-- this is secured page. login first to access it -->
    <cms:if k_logged_out >
        <cms:redirect "<cms:login_link />" />
    </cms:if>                 

<cms:template title='Add New Absence' clonable='1'>
    <cms:editable name='fullname' required='1' type='text' />
    <cms:editable name='first_day' required='1' type='text' />
    <cms:editable name='lenght' required='1' type='text' />
    <cms:editable name='faciliation' required='1' type='text' />
    <cms:editable name='followup' required='1' type='text' />
    <cms:editable name='cause' required='1' type='dropdown'
        opt_values=' Vennligst velg=- | Yrkesskade | Fritidsskade | Sykdom | Barn og familie'
    />
    <cms:editable name='vedlegg' required='1' allowed_ext='pdf, doc, docx' max_size='1024' type='securefile' />
</cms:template>       
       
    <div class="container body">


        <div class="main_container">

            <div class="col-md-3 left_col">
               
            <?php include ('menu.php'); ?>
               
                <div class="right_col" role="main">
                    <div class="">
                   <div class="row">
                            <div class="col-md-6 col-xs-12">
                                <div class="x_panel">
                                    <div class="x_title">
                                        <h2>Registrer Nytt Fravær</h2>
                                        <ul class="nav navbar-right panel_toolbox">
                                            <li><a href="absence.php"><i class="fa fa-chevron-right"></i></a></li>                                           
                                        </ul>
                                        <div class="clearfix"></div>
                                    </div>
   
                                    <div class="x_content">
                                    <br />                                       
                               
         
<cms:set submit_success="<cms:get_flash 'submit_success' />" />
<cms:if submit_success >
    <h4>Fravær ble lagt til...</h4>
</cms:if>

<cms:form
    masterpage=k_template_name
    mode='create'
    enctype='multipart/form-data'
    method='post'
    anchor='0'
    >

<cms:if k_success >

    <cms:db_persist_form
        _invalidate_cache='0'
        _auto_title='1'
    />

    <cms:set_flash name='submit_success' value='1' />
    <cms:redirect k_page_link />

</cms:if>

    <cms:if k_error >
        <div class="error">
            <cms:each k_error >
                <br><cms:show item />
            </cms:each>
        </div>
    </cms:if>

<label>Fult navn</label>
<cms:input name="fullname" type="bound" class="form-control" />
<br />

<label>Første fraværsdag</label>
<cms:input name="first_day" type="bound" class="form-control" />
<br />

<label>Lengde på fravær</label>
<cms:input name="lenght" type="bound" class="form-control" />
<br />

<label>Tilrettelegging?</label>
<cms:input name="faciliation" type="bound" class="form-control" />
<br />

<label>Oppfølging? </label>
<cms:input name="followup" type="bound" class="form-control" />
<br />

<label>Årsak til fravær</label>
<cms:input name="cause" type="bound" class="form-control" />
<br />

<label>Last opp sykemelding</label>
<cms:input name="vedlegg" type="bound" class="form-control" />
    <p>Kun Word eller PDF Dokumenter</p>
    <br />

    <cms:if "<cms:not submit_success />" >
        <button type="submit">Legg til nytt fravær</button>
    </cms:if>

</cms:form>

                                 
                                   
                                    </div>
                           
                                </div>
                       
                            </div>
                            <div class="col-md-6 col-xs-12">
                                <div class="x_panel">
                                    <div class="x_title">
                                        <h2>Hjelpetekst</h2>
                                       
                                        <div class="clearfix"></div>
                                    </div>
   
                                    <div class="x_content">
                                                                                                              
                                        <b>Fult navn </b>skal alltid fylles ut riktig!<br /><br />
                                        <b>Første fraværsdag </b>er den første dagen den ansatte er borte fra jobb. Skriv dato i formatet 10.10.1010
                                 
                                   
                                    </div>
                           
                                </div>
                       
                            </div>                       
                        </div>
                               
                    </div>
               
                </div>

            <div id="custom_notifications" class="custom-notifications dsp_none">
       
                <ul class="list-unstyled notifications clearfix" data-tabbed_notifications="notif-group"></ul>
       
                <div class="clearfix"></div>
       
                <div id="notif-group" class="tabbed_notifications"></div>
   
            </div>

    <script src="js/bootstrap.min.js"></script>
   
    <script src="js/nicescroll/jquery.nicescroll.min.js"></script>
    <!-- icheck -->
    <script src="js/icheck/icheck.min.js"></script>

    <script src="js/custom.js"></script>

</body>

</html>                
       
<?php COUCH::invoke(); ?>

I think you can use the solution discussed here - viewtopic.php?p=2483#p2483

Create a snippet that lists the users and you can feed that into the dropdown.

Hope it helps.
2 posts Page 1 of 1
cron