Angular Schema Form Custom Template Passing Parameter - angular-schema-form

I've been searching for a while now and can't find any examples of how I could pass a custom value to a template I created with Schema Form. I needed to create a template to allow for the label to be aligned any way the user wants it to be. I got a simple version of the template working, now I need to give the template information like where the label should be aligned and how many columns the field should take so I can have multiple fields on a single row. I've tried passing my custom fields in the field definition and retrieving it in the template from the form object.
firstName = {
labelAlign: "left"
title: "First Name"
type: "string"
}
In the sample labelAlign is the custom field that I want to access through the form object and this is part of the data that is passed through the sf-schema directive. Is there another way I can access this data in my template?
Thanks in advance.
UPDATE
If I pass the custom value in the form JSON instead of the schema JSON the value show on the form but it creates another field at the very end of the form which is not what I am looking for. I've seen schema form examples that show modifying fields in the form JSON without having this problem. Does anyone know how to make this work properly?

I found the answer to my question and want to post it here for others. The object I was looking for was form.schema. That will allow access to properties created in the schema JSON.

Related

New field types in Gentics Mesh schema

I'd like to add custom field types like 'email' or other strings that could use regex validation.
Also, numeric fields with validation like < or > or formatting like money.
I was thinking about storing a mapping of schema uuid + field name + field type, and have the UI query a new rest api to get the validation and formatting criteria when editing a node?
Does that sound like a good approach? or is there a better one?
I'm new to mesh, so I'm still learning how to approach customizations.
Thanks!
I think this relates to issue 112. At the moment it is not possible to add custom validation or custom field types. In the future more specific constraints can be added. Additionally we also plan to add a "control" property to schema fields. This field can be used to store any JSON. This JSON control property value can in turn be used in the UI to add custom form behavior or control how front-ends display/handle the value.

I want to show the all the available custom object, Standard object based on custom selection

I have some requirement to list out all the custom objects and standard object detail with label name and api name using VF page. If I choose "Custom Object", Then page should list out all the custom object with the column of label name and api name. Thanks in advance.
I believe that your use case would be best suited to using the Schema.getGlobalDescribe method. With this method you can get a list of all the fields for a given object.
Schema.getGlobalDescribe.get('Contact') returns a Schema.describeObjectResult object that can be further probed to get the field names and labels. To get a Map of all the fields on the Contact object you could call:
Schema.getGlobalDescribe().get('Contact').getDescribe().fields.getMap()
From that result you could iterate over the map to display all of the results. You would want to use an outputPanel with a nested repeat to produce the results.

CakePHP 2.x multiple select box

I create by $this->Form->input('field') automatic populate multiple select box.
But how to use code above to select options in edit action which saved values?
make sure your form is created with the correct model
eg `$this->Form->create('Article');
pass a variable as the singular of your model from the Controller via $this->set(). For example, if your model is "Article", then pass a variable with the data:
$this->set('article', $article);
it will populate automatically
Next time you ask a question on StackOverflow, provide information on what you've tried, what worked, what didn't, what you've search for but couldn't find...etc, so it doesn't feel as though we're just writing code for you.
Update (per additional info in comments):
For HABTM, create your field with the model:
$this->Form->input('PartnerState');
Then pass a variable camelCase plural:
$this->set('partnerStates', $partnerStates);

how retrieve only selected checkbox values in action class in struts 1.3

i am new struts i am developing web application in which i have a requirement that i have to show records in tabular format i have made use of display tag in struts with every record i have a checkbox now i need to retrieve the values of those checkboxes in my Action which are checked . but what i am receiving in Action array of all the checkboxes. actually while displaying checkboxes by making use of display tag all checkbobes have got same name therefore i am not understanding how handle this care i have searched on google but did not find suitable situation
<display:column title="Service">
<input type="checkbox" name="sercive" />
</display:column>
how to handle this situation not understanding .could anyone give some sample code
or hint to handle this situation
I am not sure about display tag.
But in struts you have to define a property in Form bean (i.e. ActionForm) of type String[] or List with the name same as defined for your check boxes.
Then in Action class you will get the array of selected checkboxes only.
If this is not working. Then you can try of getting the values using request.getParameter("service"). This will return comma separated list of selected checkboxes which you can convert to array using split() method and then you can continue with your logic.
I hope this helps you.
Plain HTML checkboxes are only submitted if they're checked, that's just how clients work.
You must provide a differentiating factor, generally a value (e.g., a service ID in your case), to determine which has been selected. Your action form would contain a collection of those IDs.

ExtJS loop through form fields that got a specified name

I'm using ExtJS 3. I have a formPanel with many "cloned" fields and I gave every field the name "price[]". After submit I would like to loop through every field that has the name "price[]" and get their values one at a time to be checked against something in the database.
Note: there are other fields in this form so that's why I need to specify witch items to get from it, by name. I know how to submit the form, I just need to loop through those field and get their values.
How can I do this ?
Thank you!
You can use the find(propName, value) method of FormPanel. It returns an array of all the matches. The matches will be Ext.form.WhateverField objects, depending on what types of input elements your form has, and not raw DOM elements.
var priceFields = myFormPanel.find('name', 'price[]');
The BasicForm object has a property items: it is a mixed collection. You may iterate over the collection.
ExtJS forum

Resources