자동 완성이 첫 번째 양식의 값을 채울 때 동일한 페이지의 다른 양식에서 다른 입력을 채우는 방법을 알아야합니다.자동 완성이 다른 양식 입력을 채우는 방법
예와 같이 동일한 페이지에 세 개의 양식이 있고 다른 양식을 채우기 위해 첫 번째 양식의 자동 완성 값에있는 ID를 채워야하는 경우 어떻게해야합니까? 여기
예제 코드 : 사용자가 아약스와 함께 제출 버튼을 쳤을 때
//First form, in the license input the autocomplete fill the license, owner, brand and the id
<form method="post" name="first" id="first" class="form-horizontal">
<div class="row form-group">
<label class="col-sm-3 text-right">Car license number:</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="license" id="license"> // autocomplete input
</div>
</div>
<div class="row form-group">
<label class="col-sm-3 text-right">Owner:</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="owner" id="owner">
</div>
</div>
<div class="row form-group">
<label class="col-sm-3 text-right">Brand:</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="brand" id="brand">
</div>
</div>
<input type="hidden" id="idCar" name="idCar" /> // hidden input needed in the other forms
<input type="submit" id="sCar" class="btn btn-info" value="Save Car" />
</form>
//Second form
<form method="post" name="second" id="second" class="form-horizontal">
<div class="row form-group">
<label class="col-sm-3 text-right">Requested work:</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="reWork" id="reWork">
</div>
</div>
<div class="row form-group">
<label class="col-sm-3 text-right">How many miles in this diagnosis have the car:</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="miles" id="miles">
</div>
</div>
<div class="row form-group">
<label class="col-sm-3 text-right">Type of oil used:</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="oil" id="oil">
</div>
</div>
<input type="hidden" id="idCar" name="idCar" /> // Hidden input needed to fill previously in the first form
<input type="submit" id="sDiag" class="btn btn-info" value="Save diagnosis" />
</form>
등등 ... 페이지 양식입니다 .. 각 차량의 진단 및 수정을위한 다섯 개 가지 형태가 제출. 내 문제는 autocomplete가 첫 번째 양식의 값을 채울 때 다른 양식의 동일한 ID를 추가하는 방법입니다.
당신이 라이센스 에서 값이 다른 2 이름 idCar에 삽입됩니다 의미합니까? – synz
@synz mmm 아니오, 다른 양식에 값 idCar을 삽입해야합니다. 예를 들어, 사용자가 라이센스 번호를 입력하면 12345가 자동 완성으로이 라이센스의 소유자를 브랜드 및 ID로 채 웁니다. 라이센스 자동차, 그래서 다음 양식에서 idCar (숨겨져있다) 첫 번째 양식의 idCar가 필요 –