Pass textarea values to jsp - html

I am populating a list of string from jsp to an html <textarea>. e.g.
out.println("<textarea name='word_suggest' rows='10' id='word_suggest'>");
while(it.hasNext()){
out.println(it.next());
}
out.println("</textarea>");
I want the user to edit the textarea and read back the values to jsp (e.g. create another list of strings) so that I can work around with the new list. Can I do this without using the <form> and <post> action e.g work around within the same page?

Related

Get value of HTML5 input type search from code behind after postback in .NET

I'm creating a sample textbox for search like this (I'm using VB) in my webpage:
Dim txtSearchFilter As New HtmlGenericControl("input")
With txtSearchFilter
.ID = "txtSearchFilter"
.Attributes.Add("placeholder","Filter")
.Attributes.Add("type","search")
.Attributes.Add("maxlength","80")
End With
It's great, because this is the HTML5 style box which has some useful features, such as the "x" on the right side of the box to clear the text entry. However, from the code behind, I can't retrieve the text that was entered. I've tried:
txtSearchFilter.InnerText
txtSearchFilter.InnerHtml
txtSearchFilter.Attributes("value")
Request.Form("txtSearchFilter")
But none of these work. Is there a way to get the value?
P.S., SO prevents me from selecting the HTML5 tag and, instead, puts in the HTML tag even though I selected the HTML5 tag.
Add a name attribute to the input element.
txtSearchFilter.Attributes.Add("name", "txtSearchFilter")
Then on postback, you can retrieve the value by Request.Form(name_attribute). Example based on the above code :
Dim value as String = Request.Form("txtSearchFilter")

Some part of my Django form should change based on TypedChoiceField list selection

I am new to Django. I have a requirement where in based on the TypedChoiceField list selection some part of the form should be changed. Meaning for a particular selection I need some fields to be displayed on the webpage and for other selection I need some other fields to be displayed on the webpage.
If there is already a similar page existing, please point me to that page, it will help me a lot.
What I would do is set up a javascript static file (here's a tutorial) that hides and shows elements using the select method.
For example, if you had categories that each needed a different set of fields, you could put all your categories into a <select> element and then using some simple JS, display the desired fields:
$("#select_object").change(function () {
toggleFields();
});
In that case, #select_object would be that <select> element. Whenever it changes (the user selects something) it shows the fields you want.

How to prevent AngularJS from validating form controls for the first time

I my form I have some input controls which are bounded with controller's scope data. Based on users selection I am bounding selected item by using ng-model to input controls.
I am validating those inputs by using ng-maxlength ,minlength ,ng-pattern and other inbuilt validation directives.
Class for highlighting the invalid values.
.ng-invalid { border-color:red; }
But when user wants to add a new product, then I am creating an empty object and adding it to controller's scope data.
At the very first time while creating new item I don't want to highlight every thing with red, because very thing is empty.
Is there any way by which I can highlight invalid input on their focus and after it will show as invalid until use put some valid values in it.
When use select any existing data then I am validating control at that movement.
You can use forms' $pristine as a condition for your classes.

HTML input submit a list of items that are variable

I've got a Jquery UI sortable list with add item option. I want to gather these items up and submit them. what input type should I use?
Use the serialize method of the sortable object (http://api.jqueryui.com/sortable/). This method returns a string that you can send using a text input or a hidden one.

Keeping Form id like numerical value in the HTML Dom Element

In my application i want to keep my Form id in the Dom element So that on click of my Dom element, i get to know the Form id and make use of that for further purpose.
For eg:
my app has a list of form names generated like
Contact Form
Personal Form
I want to save my form id that is 1 somewhere in the Dom element a.
And onclick of that link i want to make use of it for further things . How can i do .. Where can i save my Form id in the Dom element.Please suggest me..
Edit:
In my application by using JQuery, i am generating list of Form names by fetching it from by MYSQL database using CakePHP framework.
eg:
$('#entryManager').click(function(){
$("<p class='title2'>Forms</p>").appendTo("#fb_contentarea_col1top");
$("<ul class='formfield'>").appendTo("#fb_contentarea_col1down");
<?php foreach ($Forms as $r): ?>
$("<li><a id=Form'<?=$r['Form']['id'];?>' href='/FormBuilder/index.php/main/entryManager'><?=$r['Form']['name']?></a></li>").appendTo("#fb_contentarea_col1down .formfield");
<?php endforeach; ?>
return false;
});//entry Manager Click
On click of Entry manager the Form names are listed .
And now i want to use some function like onclick of each Form name i want to retrieve the Entries filled by invitees from the database.For this i want the FOrm id each Form name to store it somewhere in the DOm element so that i can get that value (form id) and send it to my ajax request to fetch the entries filled..How can i do so???
Don't use purely numeric id's, it's best if they start with a letter, but essentially you can can have...
<form id="form1"...>
And then store the information in your anchor like this...
<a rel="form1">Click...
Then you can pull the "rel" tag out and use it to reference form1.
This is technically stretching the purpose of the rel tag, but does work.
document.forms is an array that contains all of your forms and you can do something like this:
document.forms['myFormId'] and you would get the form of that ID. But yet I am not getting what you are trying to achieve. May be if you elaborate on it further then I can guide you better on this.