Hi Im creating an app using ionic and angularjs. The problem I face is in the editing. I have a two view pages, one view will list the car names, when a car name is selected it will be redirect to the second view page where the information regarding the selected car is listed and also editable . Im able to get it till here but I don't know how to edit the content. I tried using contenteditable along with <div> property but angularjs can't bind the ng-model property. So please help me how to edit the read information so that the edited information are updated. Thank you.
Selected Car:
<input type="text" ng-model="editedName">{{selectInput.name}}</div>
<br><hr>
Selected options:
<div ng-repeat="type in selectInput.types" ng-model="selectedTypes">
{{type}}
</div>
</div>
<br><hr>
<button ng-click="Update($index)">Update</button></div>
Related
I am struggling with a problem to show a form conditionally using Thymeleaf. I want to show a form as in the image below: Hide form using Thymeleaf
Initially the pick up id column should show some text like 'edit' or 'n/a' with a link and when the user clicks on the link(or button) then only the edit box should be visible as in the image.
As you can see I have already created the form but I am having trouble with hiding the form and showing it only upon clicking a link or button and when user clicks on save, the id is saved to database(already done) and the entered id should be shown instead of the form.
I searched a lot about it but could not find anything using thymeleaf. I had found some related answers using JavaScript/jQuery but I need Thymeleaf.
The relevant part of the code
<td>
<a><span th:if="${ticket.pickedUp} ? ${ticket.pickUpId} : 'N/A'"></span>
<form th:action="#{/updatePickupId/{id}(id=${ticket.id})}"
th:method="post" th:style="'display: hidden'">
<div class="checkbox-list w-150px">
<input type="text" name="pId" value=""
placeholder="Pick Up Id"
th:classappend="${ticket.pickedUp} ? 'required' : ''">
<input type="submit" value="Save"/>
</div>
</form>
</a>
</td>
As you can see I have used th:style="'display: hidden'" in the form but I don't know why its not working and the form is visible all the time.
I have created a dropdown list on my webpage using a basic statement in HTML but it is in the body section of my page. I added a search bar in my topnav and have been attempting to move this dropdown list so it appears there once someone clicks in the field or starts to type, but the data in the dropdown list is from an SQL database (corporate company) and not a predefined list such as . I am using local ASP to pull the data from SQL, and HTML & Java to populate it.
Does anyone know how to write the HTML & Java so that the dropdown list with my data appears in the search bar once someone clicks in the search bar? My code is below.
This is my logic that originally worked
<select id="containerlist" onchange="newcontainer()"></select>
This is the logic that I have been trying
<div class="search-container">
<input id='input' type="text" placeholder="Container #.." onkeyup="filterFunction()"<select id="containerlist" onchange="newcontainer()"</select>/>
<button type="submit">Search</button>
</div>
I also tried the code below but not sure what I would put in the value section for the option...
<div class="search-container">
<input type="text" list="containerlist" />
<datalist id="list">
<option> id="containerlist" value="?"</option>
</datalist>
</div>
The output should be, I can click into the search bar, and start to type and the dropdown list will appear and filter as I continue to refine my search.
i am loading handlebar templates in the two div locations(like add and edit tabs both are jsps) from the same page. so i have duplicate elements in the DOM object, since it is a template which is coming from server location. you can see the sample code below
<div id="add">
<div id="exploding">
<input type="text" name="city" id="city"/>
<input type="text" name="state" id="state"/>
...
</div>
</div>
<div id="edit">
<div id="exploding">
<input type="text" name="city" id="city"/>
<input type="text" name="state" id="state"/>
...
</div>
</div>
I can't modify the div container ids i.e exploding since some javascript functions attached to it based on that id to explode address field.
here the problem is if i made any changes to the edit tab, address "exploding" div, it is effecting in add tab address "exploding" since ids are repeated. i have tried jquery detach method to remove the dom elements, but didn't get proper result. Its a web application based on spring boot.
is there any possibility to load jsps dynamically through jquery, i have tried load method as well, but the call is going through controller. I didn't feel it as better option.
Thanks & Regards
krishna K
Now I am working in an search functionality module using angularjs, search functionality is implemented by multiple select options, user can select more than one option in select tag, it's not a problem, but I am facing issue to load the saved search details into the select tag,(have to show pre-selected search data into the select tag)
<select name="" ng-model="sex" multiple ng-options="sex.name as sex.name for sex in choosesex">
</select>
which displays the list like Male and Female like below,
$scope.choosesex = [{ID:1,name:"Male"},
{ID:2,name:"Female"}];
I have get the json response from saved search, while pushing the result into the ng-model it doesnot show the selected option in select tag, Please share your opinions regarding this issue to fix. Thanks in advance.
sex.name as sex.name is not right. Try this:
<select name="" ng-model="sex" multiple ng-options="sex as sex.name for sex in choosesex"></select>
I'm currently working on an AngularJS project where user inputs from a drop down list and a text box on a page can be displayed on a new page. For instance, selecting option of Mr and entering a name which is then displayed on a new page as "You're Mr YourName." How can this be done? Any help?
<select ng-model="title">
<option>Mr</option>
<option>Ms</option>
</select>
<input type="text" ng-model="yourName">
You're {{title}} {{yourName}}