Need to fill Dropdown field by selecting a value from another dropdown - javascript

I'm looking for a logic, where there is a dropdown which has some set of pre-loaded addresses(Street, city, country, state, ZIPCode). The country and state must be dropdown fields.
Now, on selecting one pre-loaded address, it should autofill the country and state.
For example, if the address: Street1, CityNAme, CountryName, StateName, ZIPCOde is selected from the drop down, it should search the CountryName, StateName from Country and State dropdowns and autofill accordingly.
Is it possible to write the code in javascript? I need to include this logic in my SharePoint2013 application.
Please let me know if the requirement is unclear.
Any help is appreciated!

Yes,we could achieve this with JS.
I don’t know the structure of your data, the data source and you didn’t specify the fields that need to be filled in automatically, so I can only give you some ideas.
Firstly,you need to make sure which column values can determine a unique object.
Secondly,Write these columns on the page, you can choose to hard code the values in them, or you can choose to get them from the data source.
Thirdly,When the object can be uniquely determined, you can filter out the object from the data source and automatically populate the value on the page through js/jQuery.

Related

How to remove or delete a value after change a select value

After creating a new process to filter value by date, I'm getting an issue due data to persisting after changing the table view. The data that is shown in the app-list-table change, after is select an option in the select into de app-search.
<app-global>
<app-search>
<select></select>
</app-search>
<app-list-table></app-list-table>
</app-global>
When the app loads the first time, this shows shipments information, there is not any issue, because the options is empty.
Then, when any user chooses a date in the column that is a date column on the same table, no problem with that.
The problems come, when any user makes some search filter by any data, but, specifically, with the new date filter, because the data is sent as an object. For the record, if any user chooses any date without matter what column date, they don't have any issue while don't change the table view.
Now, in the image above, we can see how the value persists even changing the data on the table switching between any options on the select. No matter what is the previous or current table, if any filter was made previously, the issue show up.

Vue- How can I control the behavior of chips in v-autocomplete?

I have a 20-25 names coming from API where I'll need to show them in a drop down box (requirement). I'm using Vue v-autocomplete here to display the selected names on the field. I've used custom item called Select All where the user can select all the names in the drop down list, but what I also need to do when the user clicks on Select All is that I don't want to show all the names in the Autocomplete field including Select All Chip. Only items that are selected individually without Select All should show as Chips.
Here is my code sandbox I've attempted so far. I'm new to Vue js, so I'm hoping to get some thoughts on controlling the chips on v-autocomplete.
v-autocomplete sandbox
Instead of including "Select All" in the array of names, you can use the prepend-item slot to include a separate Select All checkbox.
If you need to differentiate between names selected via individual click and those selected via the Select All checkbox you will probably need a new property in the names array to track that, say a boolean that is true if selected one way and false the other.
You'll also need a slot like selection to customize the display of your chips where you can use v-if to conditionally render a chip based on that new boolean property.
This codesandbox I believe is pretty close to what you're after

Multiple unique columns in sharepoint

I'm creating a new form in SharePoint with the following fields:
Name
Phone
Email
But, I need that every column in the list is unique, it can't be any row with the same information.
I have an idea how to do this with javascipt, but don't know how to access to do a query in sharepoint to see if there is the same information.
If someone could help me with any solution would be great.
Thanks
I need that every column in the list is unique,
Are you saying that only one row in the list can have a certain email address? If so, just set "Enforce unique values:" for that column to "Yes". (Repeat for each column.)
If you want a column value like Email to be unique you can use the "Enforce Unique values" from the columns settings like shown below.
However if you want multiple columns to be unique like a composite unique key you will have override the presaveaction in the page to do a check before inserting the record. you can get more details of the presave action in the below link.
https://sharepoint.stackexchange.com/questions/91854/what-is-the-difference-between-presaveaction-and-presaveitem-on-sharepoint-l
https://social.technet.microsoft.com/wiki/contents/articles/31330.sharepoint-using-presaveaction-function-on-custom-list-forms.aspx

How to send value of drop down item to export plugin?

I am new in Grails. I have a drop down box and a button which generates PDF. I am able to generate and download PDF using following tag
<export:formats formats="['excel', 'pdf']" />
But, now I want to select item from drop down and pass that selected item to the export tag like below
<export:formats formats="['excel', 'pdf']" params ="Pass selected item here"/>
I tried a lot but no luck. Does anybody know how to pass selected item value of drop down to the export tag?
In your controller use flash.value = params?.value inside the appropriate method. This will allow you to store the key:value pair for one transaction only.
In the GSP page define the select box value value="${flash?.value}" and give the select box an ID.
Assuming you want to pass the variable into the business logic, in your controller use an if statement to check for the select box value and follow the appropriate logic based on each value.
Flash is a temporary key:value storage mechanism for one request only. For more information on flash check out the documentation.

JS - Advice on how to merge multiple user input to one form field design

I have a page that allows users to enter a lot of information about them (metadata) they can then click on a icon which opens a modal window containing a googlemap which allows them to add locations, and a title for that location.
Using mootools I can pass the value of a form field back to the original form, using onclose. The main page form then has a single hidden input field, which goes into the database as one field, serialised.
The problem is a user can add as many locations as they want, there are also 3 types of location. Each with its own set of co-ordinates, which can be single or multiple!
So I want to know the best way to handle all of this data, is it possible to load it into one form and then use Moo to submit that form to a single form field, or can I use moo to just append all the information into a single hidden input field, but if I do that, how does user input come into it. Im stumped and looking at some suggestions on how to set this up in the 'best' possible way.
Currently I have a table, and each item is added as a new row, by JS when a user clicks on the map, it creates a new row with the details about the click, item and then a user input field.
If its a single location then its added as 'placemark', a user input field for the name and then the co-ordinates go into a 3rd table cell.
However if its a shape, then the first cell contains 'shape', user input field for name/description, and the third cell contains a list of co-ordinates one for each point, this is the same for lines.
The problem I have is I could write it all to a single form field, but then how do I allow for user input of the titles, I need to use a form field for that? The other option is to take each row from a table and input it into the single form field, seperated by a pipe or similar, but then im not sure if I can read from other form fields.
I hope the above makes some sense!! All feedback welcome!
Im using mootools for this, but providing I can get my head around the layout then that should not really be an issue.
I would suggest that you use an object to maintain all of the location data while the user is making their selections. When, when the form is submitted, serialize that data into a hidden field as a JSON object.
So, when the user clicks in the map window, you record the info in the object, in addition to the table. The populated object would look like this:
var usersLocations = {"locations": [
{"type": "point", "coords": [100,200]},
{"type": "line", "coords": [[200,300],[400,500]]},
{"type": "shape", "coords": [[200,300],[400,500],[1000,1500]]}
]
};
Mootools may have some JSON methods, but if not, look at http://www.json.org/js.html for working code. You can use JSON.stringify() to convert the object into a plain string suitable for saving in the DB, and when you get that string back out, you can use JSON.parse() to turn it into an object again.
As for handling the user input, you could write the table to the page just as your do now (or base it on the above object). Then when the user enters something in one of the fields, copy the value into the usersLocations object. So have an onBlur event handler on the input field that updates the data structure (something like this) :
usersLocations.locations[0]["type"] = "<what the user typed>";
are you looking for something like this?
usersLocations.locations[0]["name"] = document.getElementById("location0name").value;

Categories

Resources