We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Angularjs id does not get past from my list to my value

Thread ID:

Created:

Updated:

Platform:

Replies:

118784 Apr 9,2015 11:22 AM Apr 15,2015 03:39 AM JavaScript 3
loading
Tags: ejDropDownList
steve mangelschots
Asked On April 9, 2015 11:22 AM

Hi

I got a list with value's  the id field is idResource and the text field is Name the value is set to scheduledate.idResource 

the code looks like this

<input id="resourcelistcontrol" ej-dropdownlist e-datasource="resourceList" e-fields-id="idResource" e-fields-text="Name" e-value="scheduledate.idResource" />


the value in the resourcelist looks like idResource: 1, Name: Steve



But wen I submit and look at the result the value of the name field goes to my scheduledate.idResource and not the idResource so Steve gets past on to the scheduledate.idResource.
What am I doing wrong?

thanks




Sasikala Nagarajan [Syncfusion]
Replied On April 10, 2015 08:45 AM

Hi Steve,

Thank you for using Syncfusion products

We analyzed your query, but we are unable to reproduce the reported issue. When we submit the form, the value of selected item in DropDownList gets posted in form submit.

We have prepared a simple sample based on your requirement. Please get the sample from the following location:

Sample

In this sample, if we submit the form then we will get the value of the selected item in alert box. We have achieved this using ng-submit to showcase the posted value in form submit.

Please check with the given sample. If we have misunderstood your query, please provide more details on your query or else please reproduce the issue in the given sample and revert us the modified sample and that will be helpful for us to provide the prompt solution.

Please let us know if you have further queries,

Regards,
Sasikala Nagarajan


steve mangelschots
Replied On April 10, 2015 10:10 AM

Hi Sasikala

The example proves my point that if I set the  e-fields-id this get not passed as a value but the value of the list.

you have created a list with ' empid: "cr1", text: "Dodge Avenger", value: "cr1_Dodge Avenger"' I would suspect the output value to be cr1 not cr1_Dodge Avenger.

I have changed the example to match my list.
Or does a list has to have a value field to make this work?

thanks



Attachment: 118784DropDown_Angular790438135_Steve_4d12dd22.zip

Harikrishnan P [Syncfusion]
Replied On April 15, 2015 03:39 AM

Hi Steve,
Thanks for your update.
Query: you have created a list with ' empid: "cr1", text: "Dodge Avenger", value: "cr1_Dodge Avenger"' I would suspect the output value to becr1 not cr1_Dodge Avenger.
We would like to inform you that, in dropdowlist control,the ‘value’ of the selected item will be obtained in the form submit. If you do not specify the ‘value’ field means ‘text’ of the selected item will be obtained in form submit.
Here you are trying to get the ‘id’ of the selected item. If you want the ‘id’ in the form submit means, we need to map the attribute that is specified for ‘id’ field to ‘value’ field also. Please refer the below code


<input id="bookSelect" ej-dropdownlist e-datasource="dataList" e-fields-id="empid" e-fields-value="empid" e-fields-text="text" e-value="value" />



Now ‘id’ of each item will be assigned as value for the ‘value’ field. So during form submit, we can get the value as ‘cr1’.
Query : does a list has to have a value field to make this work?
No it is not necessary for a list to have value field. We can simply map the attribute that is specified for ‘id’ field to ‘value’ field also. Then we can be able to get the “id” in the form submit.
For your reference we have attached the sample in the following location, please check with it.
Sample Location : Dropdown sample
Please let us know if you have further queries.
Regards,
HariKrishnan

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;