duanfa2014 2018-08-18 06:14
浏览 44

我在数据库中有患者信息,现在我想在Laravel Project中以另一种形式访问一个人的信息

I have patients information in database, now I want to access one's information in another form. When I will input patient's ID the patient name field need to be filled/loaded automatically. I have my Patient model also.

This is the from...

<form method="post" class="" action="" >
    @csrf
    <div class="input-field col s3">
        <input name="patient_id" id="id" type="text" class="validate">
        <label class="active" for="id">Patient ID</label>
    </div>

    <div class="input-field col s9">
        <input name="patient_name" id="name" type="text" class="validate">
        <label class="active" for="name">Patient Name</label>
    </div>

    <div class="input-field col s12">
        <select name="room">
            <option value="" disabled selected>Select Room</option>
            <option value="2001">ROOM 2001 - Non AC - 500</option>
            <option value="4001">ROOM 4001 - AC -800</option>
            <option value="301">CABIN 301 - AC - 1700</option>
        </select>
    </div>

    <div class="input-field col s12 text-center">
        <button class="btn waves-effect waves-light" type="submit" name="action">Assign Room</button>
    </div>
</form>
  • 写回答

5条回答 默认 最新

  • dqm4675 2018-08-18 06:55
    关注

    You can

    1. create the json object in the blade template, which may be a little messy if special characters are present. Also, i don't see this as a good solution if you have tons of records.

    2. I would use a library, like https://select2.org/, what you'll be looking for is here https://select2.org/data-sources/ajax ... i personally use this one https://semantic-ui.com/modules/search.html#/examples... but i think select2 is more straight.

    At the bottom of https://select2.org/data-sources/ajax you can see how an object with the full data can be passed while querying the server.

    Since the name is just for searching the id ( I Assume)

    You could also adjust your controller so it looks in CONCAT(id,name) so the user can type the id or name and find the patient.

    评论

报告相同问题?

悬赏问题

  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 MATLAB中streamslice问题
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序