0

i have the following html to Capture some Data.

<fieldset>
    <legend>Rezept hinzufügen</legend>

    <form action="php_act/create.php" method="post">
        <table cellspacing="0" cellpadding="0">
            <tr>
                <th>Rezept Name</th>
                <td><input type="text" name="name" placeholder="Rezept Name" /></td>
            </tr>     
            <tr>
                <th>Kurzbeschreibung</th>
                <td><input type="text" name="kurztext" placeholder="Kurzbeschreibung" class="kurztext" /></td>
            </tr>
            <tr>
                <th>Kategorie</th>
                <td><input type="text" name="Kategorie" placeholder="Kategorien - mit , trennen" /></td>
            </tr>

            <tr>
                <th>Anforderung</th>
                 <td><select name="Anforderung">
                    <option value="einfach">einfach</option>
                    <option value="mittel">mittel</option>
                    <option value="schwer">schwer</option>
                </select></td>               
            </tr>

            <tr>
                <th>Zeit / Nährwerte</th>
                <td><input type="text" name="zeit" placeholder="Zeit in minuten" /></td>
                <td><input type="text" name="KCAL" placeholder="KCAL" size="6"/></td>
                <td><input type="text" name="KH" placeholder="KH" size="6"/></td>
                <td><input type="text" name="Eiweiss" placeholder="Eiweiss" size="6"/></td>
                <td><input type="text" name="Fett" placeholder="Fett" size="6" /></td>

            </tr>

            <tr>
                <th>Portionen</th>
                <td><input type="text" name="Portionen" placeholder="Portionen" /></td>

            </tr>

            <tr>
                <th>Zutaten</th>
                <td><input type="text" name="zutaten" placeholder="Zutaten" /></td>

            </tr>

            <tr>
                <th>Zubereitung</th>
                <td><input type="text" name="zubereitung" placeholder="Zubereitung" /></td>

            </tr>

            <tr>
                <th>FotoliaID</th>
                <td><input type="text" name="FotoliaID" placeholder="FotoliaID" /></td>

            </tr>


            <tr>
                <td><button type="submit">Speichern</button></td>
                <td><a href="index.php"><button type="button">zurück</button></a></td>
            </tr>
        </table>
    </form>

</fieldset>

There are some Input Type Text. i need to capture line breaks within the textfields. Problem is that "Enter" submits by default the. Is it possible to change that. Enter should add a line break in the textfield and not submit the form.

swapfile
  • 415
  • 2
  • 19
  • Possible duplicate of [How to prevent ENTER keypress to submit a web form?](https://stackoverflow.com/questions/585396/how-to-prevent-enter-keypress-to-submit-a-web-form) – Ali Adlavaran Jul 26 '17 at 09:47

1 Answers1

2

Can't you use textarea instead of textbox? In a textarea you can insert enters.

https://www.w3schools.com/tags/tag_textarea.asp

Oak
  • 352
  • 4
  • 13