Alpacajs: Making a hidden field mandatory on first load (unhidding) - alpacajs

I have a text field "A" which is dependant on checkbox field "B"
Field "A" is made Mandatory (required field)
when field "B" is checked field "A" becomes visible but it is not showing as mandatory at on first load rather it only is only shown mandatory when it is checked and then unchecked(to leave it blank)
I have used ā€œhideInitValidationError=falseā€ but no luck
Any guidance would be appreciated.

Related

How to obtain field values from a sitecore droplist used as a predefined list

In my template I have a field type of Droplist which maps to a Sitecore folder holding values for the Droplist which in this case is Colours. This is so that an editor cannot make a typo or invent a colour this is not in the pre-defined list.
So that colour is based off a template I call TAGS which has a single field type of 'colour' and here I create a series of items using that template to create the colours for the swatch list.
When I access the main template I duly see the colour values in that Droplist so its working as I would expect it because I can access that fields values:
tileValues.Attributes["class"] += " tile-" + Item.Fields["Tile Colour"].Value.ToLower();
However I have realized its not using the field value of the template but rather the name I have called the item. SO its just a happy mistake that its achieving the result I wanted.
However how would I obtain the actual field value for that item in the end code. I have scenarios where there will be multi lingual editors so we may name the tags as rouge, blanc etc which is what the editor will see on selection in the Droplist but we need the colour value of the field to still say red or white etc
I tried:
Item.Fields["Tile Colour"].Item.Fields["Colour"].Value
But this failed despite the API hint implying its valid.
I hope this makes sense and someone can help me obtain the actual field value and not the items name.
As Sitecore Climber wrote, don't use Droplist field type - it stores item name only and you cannot get the item itself in the code behind.
Use Droplink field type - it stores ID of the item.
Then you can get the item:
Item colourItem = Sitecore.Context.Database.GetItem(Item["Tile Colour"]);
if (colourItem != null)
{
string colour = colourItem["Colour"];
|

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

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.

Displaying extra field - specification in store front end

I have added an extra field Specification in Catalog->Product->Data tab.
This text is stored in a column called specification in product_description table.
Now I want to display this information in my Store Front (default theme). On product page there is a tab Specification that displays attribute. I want to display specification instead of attribute.
Please suggest me how to do it :(
First: edit Your Product model - should be in catalog/model/product/product.php - find the method getProduct and edit the SQL that selects the product details to also get the specification column.
Second: edit Your Product controller - should be in catalog/controller/product/product.php and make sure that Your specification column will be added to $this->data['specification'], e.g.
Third: edit Your Product detail template - should be in catalog/view/theme/default/templates/product/product.tpl and find that part where <div class="tabs"> (or similar) is - then find the tab for specification and print out Your specification column here...
Should be done.

Django skip inline field

I have an inline where the first field is always selected by default. Since both are required, is it possible to only validate and insert/update when the second field is also selected or I need to also define a default value for the second field? (Otherwise I will always get errors on the rows where only the first field is set...)
Update
I'm overriding the first widget (TextInput) render. If I set to empty then it works but I want this field to behave almost like a label.
def render(self, name, value, attrs=None):
if name == "opinion_set-0-topic":
value = "first thing"
if name == "opinion_set-1-topic":
value = "second thing"
if name == "opinion_set-2-topic":
value = "third thing"
Update 2
I need something like, if field 2 isn't set (gives "This field is required.") then bypass the form error and simply ignore the rows where this happens...
The situation is:
you have a main form to save
you have an inline subform with mandatory fields, some with default values and some without default values
Then, if you don't set all mandatory values in the inline, you get "This field is required" error.
One way to skip this situation is defining "extra = 0" in the admin.py definition of the inline form.
This way you are not forced to insert an inline object along the main one, but you can do it if you want, just clicking "+ Add another <inline>".