wg15music wg15music -4 years ago 66
Javascript Question

HTML Data Parsing from DIV Container

as I am pretty new to Web Development this might be an easy question, but I got thrown into cold water and have to get this done asap.

In my html file I use the form method GET to parse data with the URL (it must be done this way, cannot be changed).

In this html there is a Text Field.

<div class="form-group {*if $ERROR_BEMERKUNG*has-error*/if*}">
<label for="text-comment">Bemerkung</label>
<textarea name="text-comment" id="text-comment" class="form-control" rows="3" placeholder="{$TRANSLATE.USERDATA.BEMERKUNG|default:'USERDATA.BEMERKUNG'}">{$COMMENT}</textarea>
</div>


How can I get the inside of this textfield, whatever is written in it afterwards, into my GET method? Hardcoded it works that way, but I don't know how I can get the value out of the div.

<input type="hidden" id="bemerkungen" name="bemerkungen" value= "TEST" />


EDIT: I didn't have to do anything for the textarea, it got parsed correctly.

But I have another div with a number field.

<div class="width115 left form-group has-feedback">
<span id="personen"> Anzahl Personen </span>
<input class="btn-input-wrapper" id="personen" type="number" min="1" value="1"/>
</div>


The value out of there is never parsed.

Answer Source

If by textfield you mean textarea, here's your answer:

All details you have in w3c docs:

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

Example:

https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_textarea_form

When you send example, it will show you generated GET link with textarea value.

You missing form="usrform" part tho, but it should work if you keep everything between <form> tags.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download