mercredi 5 septembre 2018

show hide table on button press

I've a search form where user enters data. On search button click, if the data is found, then only display the table tbl_paytable else hide it.

view page

<form class="form-horizontal" method="POST" action="" enctype="multipart/form-data">
                
        <div class="row" style="padding-left: 1%;">
                <div class="col-md-4">
                    <div class="form-group">
                        <label>Bill Number</label><span class="required">*</span>
                        <input type="text" maxlength="15" required="required" autofocus="autofocus" autocomplete="off" name="NBillNumber" class="form-control"/>                                
                    </div> 
                </div> 
                <div class="col-md-4">
                    <div class="form-group"></div> 
                    <div class="form-group" style="padding-left: 5%;">
                        <button type="submit" class="btn btn-primary">Search</button>        
                    </div> 
                </div>                      
        </div>
</form>

<div id="tbl_paytable">
// display table 
</div>

controller block

public function searchBill()
    {
        return view ( 'pages.payBill');
    }

    public function billPay(Request $request)
    {
        $billNum = $request->input('NBillNumber');

        if($billNum != ""){
            $billsrch = OrderedBook::where ( 'BilledNum', $billNum )->get ();
            if (count ( $billsrch ) > 0)
            {
                return view('pages.payBill', compact('billsrch'));
            }                
            else
            {
                return view ( 'pages.payBill',compact('billsrch'))->with('alert-danger', 'Sorry No details found');
            }

        }
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire