Multiline textbox in html instead textarea - javascript

in a project of mine,
when trying to send contents of text-area using commons file upload, i got null value,
<td>Message</td>
<td><textarea id="msg" name="msg" rows="5" cols="38" style="resize: none;" ></textarea>
</td>
later i used hidden field and succeed in getting the value
<td>Message</td>
<td><textarea id="msg" name="msg" rows="5" cols="38" style="resize: none;" ></textarea>
<input type="hidden" id="msgid" name="msgid"/>
</td>
But i want to use multiple line textbox instead of text-area,
can any one tell me how to use multiple line in textbox?

Related

Input text area field not allowing to insert more than 1 line

I have a text box, wherein 1 line of comma separated data is getting inserted successfully, but when clicked Enter to insert another similar line. It does nothing. It does not allow to add a new line of input data.
<div class="formFields qP">
<div> <textarea id="qPA" name="qP" placeholder="Hello, help me pls"></textarea> </div>
</div>
You can add rows="number_of_rows" and cols if needed
<div class="formFields quickPaste">
<div> <textarea id="quickPasteArea" rows="4" cols="50" name="quickPaste" placeholder="Paste parts list here"></textarea> </div>
</div>
You can use <textarea></textarea> tag for that.
<textarea name="textarea"
rows="5" cols="30"
placeholder="Comment text."></textarea>

How to pass a POST variable without a form?

What is the best way to use a PHP table to hold comments from multiple different sections, and be able to distinguish between each different comments section? Is there some way to pass POST data without the need of a form?
Is there some way for me to distinguish between these two forms? Should I be using Javascript and distinguishing by the id of the forms, or is there a cleaner way?
<form action="SubmitComment.php" method="post" id="comments1">
<h3>Name:</h3><input type="text" name="name" cols="100">
<h3>Comment:</h3><input type="text" name="comment" cols="100">
<textarea rows=4 cols="100" placeholder="Enter text here!"></textarea>
<?php $_POST['section'] = 1; ?>
</form>
<!-- I want to be able to distinguish between these two forms. -->
<form action="SubmitComment.php" method="post" id="comments2">
<h3>Name:</h3><input type="text" name="name" cols="100">
<h3>Comment:</h3><input type="text" name="comment" cols="100">
<textarea rows=4 cols="100" placeholder="Enter text here!"></textarea>
<?php $_POST['section'] = 2; ?>
</form>
There is a way to distinguish forms using
<input type="submit" name="form" value="form1">
to send data, in that way you can read $_POST['form'] value and check what form it is
If you want to send data without form you can use ajax with Javascript.

Not able to send values to the input text field in chrome browser

HTML code
<textarea type="text" name="pos_description" rows="4" class="form-control ng-pristine ng-invalid ng-invalid-required ng-valid-minlength ng-valid-maxlength ng-touched" id="pos_description" placeholder="Enter Description" ng-model="data.description" minlength="150" maxlength="5000" required="">
</textarea>
My code
element(by.model('data.description')).sendKeys("Values");
Using this code am able to send values to text field in Firefox not in Chrome.

One submit button to loop thru each dynamically added textarea and insert only one textarea per row

I have a form that a user can add multiple textareas to build the form before submitting to the mysql database.
I need to add a new row to the questions_table for every question.
This is key: 1 form fires multiple insert queries. One for every question textarea.
Here is a minimal example of one table row:
There are other hidden fields in the in the form not listed below like id, user, ordering, ect... But I can only have one question column per row.
I would like to use the form submit button to loop thru each question textarea and insert one question per row. What is the best way to go about doing this?
<form action="index.php?event=submit" id="form1">
<textarea rows="4" cols="30" name="question" form="form1">Enter text</textarea>
<textarea rows="4" cols="30" name="question" form="form1">Enter text</textarea>
<textarea rows="4" cols="30" name="question" form="form1">Enter text</textarea>
<textarea rows="4" cols="30" name="question" form="form1">Enter text</textarea>
<input type="submit">
</form>

Angular JS textarea validation

I have this AngularJS code trying to show two stars next to label when there is no text in the textarea. Same code works for input tags, but not with textarea.
<div class="input-left">
<label for="email">
<span ng-show="contactform.email.$error.required" class="required">*</span>Email:
</label>
<input ng-model="email" type="text" name="email" id="email" required></br></br>
<label for="budget">Budzet:</label>
<input ng-model="budget" type="text" name="budget" id="budget">
</div>
<div class="clearboth">
<label for="msg" class="left" >
<span ng-show="contactform.msg.$error.required" class="required">**</span>Pitanja ili Komentari?
</label>
<textarea ng-model="msg" rows="8" cols="50" class="input-no-width rounded shaded left clearboth" id="msg" required></textarea>
</div>
According to AngularJS documentation - textarea should behave same as input.
Your problem with the <textarea> tag is that it doesn't define name attribute.
AngularJS uses the name attribute to expose validation errors.
You should define your textarea like so:
<textarea ng-model="msg" name="msg" rows="8" cols="50"
class="input-no-width rounded shaded left clearboth" id="msg" required>
</textarea>
Please note that having id and ng-model is not enough to properly handle validation messages. In AngularJS applications the id attribute often doesn't serve much purpose and could be omitted.
For form validation name is very important. Give it a name it should work.
<textarea ng-model="msg"
rows="8"
cols="50"
class="input-no-width rounded shaded left clearboth"
id="msg"
name="msg"
required>
</textarea>

Categories

Resources