Skip to content
Snippets Groups Projects
Commit b8c63c65 authored by gabor's avatar gabor
Browse files

Merge remote-tracking branch 'origin/CreateForm'

parents 0c2219ff 991f2b8f
No related branches found
No related tags found
No related merge requests found
@page
@using Rendelosch.Models
@model Rendelosch.Pages.CreateForm
@{
ViewData["Title"] = "CreateForm";
}
<div class="container-lg mt-4">
<form method="post">
<div class="card">
<div class="card-body d-flex flex-column">
<div class="d-flex flex-row">
<label>Űrlap neve:</label>
<input type="text" class="ms-2"/>
</div>
<div id="fields" class="mt-4 d-flex flex-column gap-2"></div>
<div class="d-flex flex-row mt-4 gap-2">
<input type="text" id="field_id" placeholder="ID"/>
<input type="text" id="field_name" placeholder="Megnevezés"/>
<button type="button" class="btn btn-outline-primary" onclick="addField()">
Új mező hozzáadása
</button>
</div>
<div>
<input class="btn btn-primary mt-4" type="submit"/>
</div>
</div>
</div>
</form>
</div>
<script>
function addField() {
// Get input fields
const input_id = document.getElementById("field_id"); // ID of the field
const input_name = document.getElementById("field_name"); // Name of the field
const fields = document.getElementById("fields"); // Div for displayed fields
// Displayed field
const field_div = document.createElement("div");
field_div.innerHTML = "<p class='mb-0'>" + input_name.value + " (ID: " + input_id.value + ")</p>";
fields.appendChild(field_div);
// Hidden input field for each created fields
const field_hidden = document.createElement("input");
field_hidden.type = "hidden";
field_hidden.name = "fields";
field_hidden.value = input_id.value + ";" + input_name.value;
field_div.appendChild(field_hidden);
// Clear input fields
input_id.value = "";
input_name.value = "";
}
</script>
\ No newline at end of file
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Rendelosch.Pages;
public class CreateForm : PageModel
{
public void OnGet()
{
}
}
\ No newline at end of file
......@@ -5,7 +5,7 @@
}
<div class="container-lg">
<a class="btn btn-primary my-4" asp-page="CreateProductForm">Create Product Form</a>
<a class="btn btn-primary my-4" asp-page="CreateForm">Create Product Form</a>
<div>
@{
foreach (var productForm in Model.Repository.GetProductForms())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment