Forums › Forums › OroCommerce › ID is not saving but the full name is inserting in database
This topic contains 4 replies, has 2 voices, and was last updated by saikatcdac 4 years, 3 months ago.
Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.
- CreatorTopic
- December 19, 2019 at 5:47 am #41132
When i am trying to save contact from contact drop down list then the full name of the contact is inserting into the database instead of ID. Please do help. Thanks in advance.
PHP12345678->add('contact', EntityType::Class, array('class'=>'OroContactBundle:Contact','choice_label'=>'first_name','choice_value'=>'id','label'=>'Contacts','required' => true,'placeholder' => 'Select...',)) - CreatorTopic
- AuthorReplies
- December 25, 2019 at 10:48 pm #41155
Make sure that in a rendered HTML of the select options values are entity identifiers. If so, then the issue could be in some data transformers, otherwise, something is wrong in a twig template for the form field.
December 26, 2019 at 5:46 am #41163Hi Andrey,
Thanks for your reply. Will you please elaborate this in a simple form/manner actually i am new to Oro as well as in Symfony.
Sorry for the pain.
December 26, 2019 at 5:56 am #41165When opening the page in a browser, you could check the source HTML to find the generated HTML of the select element with options.
December 29, 2019 at 6:41 pm #41189Thanks Andrey,
Here is the generated HTML of the select tag
XHTML1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980<select id="event_template_contact-uid-5e095d1beeecb" name="event_template[contact]" required="required" data-ftid="event_template_contact" data-name="field__contact"><option value="" selected="selected">Select...</option><option value="1">Jerry</option><option value="2">Roy</option><option value="3">Frank</option><option value="4">Jason</option><option value="5">Richard</option><option value="6">Ross</option><option value="7">Andre</option><option value="8">Wendy</option><option value="9">Bonnie</option><option value="10">Richard</option><option value="11">Catherine</option><option value="12">Jennifer</option><option value="13">Kelly</option><option value="14">Linda</option><option value="15">Christine</option><option value="16">Joshua</option><option value="17">John</option><option value="18">Donald</option><option value="19">Lois</option><option value="20">Alena</option><option value="21">Bessie</option><option value="22">Dolores</option><option value="23">Liza</option><option value="24">Calvin</option><option value="25">Nancy</option><option value="26">Ernest</option><option value="27">Henry</option><option value="28">Lorine</option><option value="29">John</option><option value="30">Priscilla</option><option value="31">Randy</option><option value="32">Robert</option><option value="33">Thomas</option><option value="34">Rita</option><option value="35">April</option><option value="36">Nick</option><option value="37">Marty</option><option value="38">Kenneth</option><option value="39">Alfredo</option><option value="40">Alicia</option><option value="41">Allan</option><option value="42">Edward</option><option value="43">Ladonna</option><option value="44">Paul</option><option value="45">Robert</option><option value="46">Christina</option><option value="47">Amy</option><option value="48">Myrtle</option><option value="49">Albert</option><option value="50">Sally</option><option value="51">Marilyn</option><option value="52">Debra</option><option value="53">John</option><option value="54">Patty</option><option value="55">Patricia</option><option value="56">Francine</option><option value="57">John</option><option value="58">Saul</option><option value="59">Francis</option><option value="60">Christopher</option><option value="61">Richard</option><option value="62">May</option><option value="63">James</option><option value="64">Roberta</option><option value="65">Arthur</option><option value="66">Merlin</option><option value="67">Zachary</option><option value="68">Catherine</option><option value="69">William</option><option value="70">Jonathan</option><option value="71">John</option><option value="72">Sophia</option><option value="73">Charlie</option><option value="74">Francis</option><option value="75">Mike</option><option value="76">Kenneth</option></select>and the twig code in update.html.twig
XHTML123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148{% extends 'OroUIBundle:actions:update.html.twig' %}{% import 'OroUIBundle::macros.html.twig' as UI %}{% form_theme form with 'OroFormBundle:Form:fields.html.twig' %}{% if form.vars.value.id %}{% set formAction = path('eventtemplate.eventtemplate_update', { 'id': form.vars.value.id }) %}{% else %}{% set formAction = path('eventtemplate.eventtemplate_create') %}{% endif %}{% block navButtons %}{% if form.vars.value.id and is_granted('DELETE', form.vars.value) %}{{ UI.deleteButton({'dataUrl': path('eventtemplate_api_delete_eventtemplate', {'id': form.vars.value.id}),'dataRedirect': path('eventtemplate.eventtemplate_index'),'aCss': 'no-hash remove-button','id': 'btn-remove-tag','dataId': form.vars.value.id,'entity_label': 'EventTemplate'|trans}) }}{{ UI.buttonSeparator() }}{% endif %}{{ UI.cancelButton(path('eventtemplate.eventtemplate_index')) }}{% set html = UI.saveAndCloseButton() %}{% if is_granted('eventtemplate.eventtemplate_update') %}{% set html = html ~ UI.saveAndStayButton() %}{% endif %}{{ UI.dropdownSaveButton({ 'html': html }) }}{% endblock navButtons %}{# {% block navButtons %}{{ UI.cancelButton(path('eventtemplate.eventtemplate_index')) }}{% set html = UI.saveAndCloseButton() %}{% if is_granted('eventtemplate.eventtemplate_update') %}{% set html = html ~ UI.saveAndStayButton() %}{% endif %}{{ UI.dropdownSaveButton({ 'html': html }) }}{% endblock navButtons %} #}{% block pageHeader %}{% if form.vars.value.id %}{% set breadcrumbs = {'entity': form.vars.value,'indexPath': path('eventtemplate.eventtemplate_index'),'indexLabel': 'EventTemplate'|trans,'entityTitle': form.vars.value.ref} %}{{ parent() }}{% else %}{% set title = 'oro.ui.create_entity'|trans({'%entityName%': 'EventTemplate'|trans}) %}{% include 'OroUIBundle::page_title_block.html.twig' with { title: title } %}{% endif %}{% endblock pageHeader %}{% block content_data %}{% set id = 'eventtemplate-edit' %}{% set dataBlocks = [{'title': 'General'|trans,'class': 'active','subblocks': [{'title': '','data': [form_row(form.ref),form_row(form.frequency),form_row(form.setupTiming),form_row(form.deliveriesTiming),form_row(form.staffHours),form_row(form.powerRequired),form_row(form.otherTraders),form_row(form.expectedFootfall),form_row(form.otherInfo),]},{'title': '','data': [form_row(form.label),form_row(form.location),form_row(form.packdownTiming),form_row(form.tradingHours),form_row(form.logistics),form_row(form.pitchSize),form_row(form.foodDemos),form_row(form.sellDrinks),form_row(form.users),form_row(form.quote_assigned_user),form_row(form.quote_assigned_customer_user),form_row(form.customer_id),form_row(form.user_owner_id),form_row(form.contact),]}]}]%}{% set dataBlocks = dataBlocks|merge([{'title': 'Fees, Cost & Revenue Details'|trans,'subblocks': [{'title': '','data': [form_row(form.estdPitchFee),form_row(form.estdCostGoodsSold),form_row(form.estdTravelCost),form_row(form.estdAccomodationCost),]},{'title': '','data': [form_row(form.estdElecFee),form_row(form.estdPayrollCost),form_row(form.estdHireCost),form_row(form.estdRevenue),]},]}])%}{% set dataBlocks = dataBlocks|merge([{'title': 'Other Details'|trans,'subblocks': [{'title': '','data': [form_row(form.internalNotes),]},{'title': '','data': [form_row(form.brandScore),]},]}])%}{% set data = {'formErrors': form_errors(form)? form_errors(form) : null,'dataBlocks': dataBlocks,} %}{{ parent() }}{% endblock content_data %} - AuthorReplies
The forum ‘OroCommerce’ is closed to new topics and replies.