Auto-fill form field - django

I have made a form field with drop down list with various choices(lets say A,B,C,D). The next field in the form is dependent on the option selected in the drop down list. How can I autofill the next field if option A is selected with a fixed value and make it charfield when other options are selected?
Edit: I have to autofill only one value when the first option i.e. option A is selected. So when the user clicks on A, it autofills 'yo'. Otherwise, in case of options B,C,D, it gives the option to enter some random word.

Related

DropList field in WFFM is showing value in message body

we have identified an issue/functional requirement that we have a droplist of countries and same goes for title like in below image
but we need that in response email body of send email save action it's Arabic text should be used instead of English value of selected option. Is there a solution or fix ? or we have to go for any customization ?
I don't think there is a way out-of-the-box to use the text instead of value. What you can do is create a custom "Send Email Message", similar to Sitecore.Form.Submit.SendMail and override the FormatMail method.
Create a list of countries items somewhere in the Sitecore Content Tree, and add a field for the text/description of the country. Then in WFFM droplist field, Set Items by: Selecting Sitecore Items and Select Root Item to the folder of the list of countries you created earlier.
You should see the countries in the preview section. Click the drop arrow for the Value and Text fields and then either select Display name or the custom field in your country item that holds the translated values.
The value submitted in form will now be the translated value correct for the language, using the lookup items list.

Making hidden field visible when another field is used

I am trying to create a section in my models code that allows me to add a value only when the previous field is selected.
The goal of the code is to do the following
Have a null or blank option
Select an option from the tuple
Showing the new field option
The example of what I am looking to do is add a warranty to an item in my model. I am trying to make a date field (or a charfield that uses a date format) that only appears when an option is selected (i.e. a date field is available when the 30 day warranty is selected) otherwise the date field should be hidden (i.e. none is selected, so date field does not show)
Any suggestions, workarounds are welcomed
This is in Django Admin only

How can I get the object value of a combobox in django view?

I am creating an app in django and to do that I have a form where the field 'Person' is a ForeignKey field. So, when I run the application it appears a form correctly showing me a combobox that lets me select the 'Person' object that I want. But the problem is when I try to catch the information in the view.
I send data with a POST method, so, when I try to get the value of the selected 'Person' object in the view I do the next:
selected_person = request.POST['person']
(Person is the field name)
I was surprised when I tested that the value of the variable 'selected_person' is a number (concretely, the number of the selected index of the element in the combobox).
My question is: HOW CAN I GET THE OBJECT VALUE OF THE SELECTED ELEMENT IN THE COMBOBOX?
Than you so much!
No, it is the primary key of the Person object in the database. So you can get it via Person.objects.get(pk=selected_person).
But really you should be using a Django form, which will then give you the Person object via form.cleaned_data['person'].
Also note, for clarity, this is a select field, or a drop-down, not a combobox; a combobox is a desktop widget that has both a drop-down and an edit field.
Concretely, the problem was I didn't have defined a "primary_key" value in the model, so, the number that the drop-down list gives me is the default primary key that django attached to the model. If I define a customized primary key for the model, the selection of the element in the drop-down list gives me the primary key.

Dropdown values customization in NetSuite

There is a custom record type configured in NS. It has a name and a free-form text field called full_name. Name is a standard field, full_name is a custom field. There is another record type which has a field of type List/Record with the previous type. On the form this field is present as drop-down. The drop-down show names of records. The goal is to show full names instead of names in the drop-down. Is it possible to mark somehow full_name field so it is available in the drop-down view instead of just name? Any ideas how to achieve this with NS?
Depending on your exact needs, it may make sense to add another custom field to the record containing your drop down. You can source this field from the full_name field on the custom record. This field does not need to store the value if it's only for display purposes.
Add a new field to the record containing the drop down
Set the type to be text
Name it appropriately
Under the 'Sourcing and Filtering' tab, set the source by field to the drop down
A field with type List/Record type can only show standard Name field. However, you can create a custom field dynamically on before record load of a user event script. Check the nlobjForm.addField. Please keep in mind that the value of it will not be saved. Saving the value is another story.

change sequence vtiger basic field in contact add form

I want that field should enter first and then other field . i am try through move the location in edit layout option and save the sequences. but when i click on add contact the set sequence not view in create contact form.
can you guide thee process for change the sequences of basic field .
Thanks & regards
Nitesh Shah
if you are not bale to change the field order from layout editor, then change the value of column "sequence" in vtiger_field table