Im trying to create a form where a user can add as many details as they want. So for example the form has an input field for name. The client has the option to add that name or to keep adding names.
I want to make the data binding value an array of names. If not it just return the last input with the value of name.
I tried doing something like this:
{{input value=name[]}}
but that automatically threw an error. How can I accomplish this in emberJs?
Unfortunately, Ember doesn't accept indices in bindings expressions. All I can propose is to use this workaround.
Related
I'm trying to build a custom UI control in alfresco to display the associations of an object type that I have.
Basically I have two object types; Code, which is a key value pair, and CodeScheme which contains multiple child associations to codes, it's essentially a mirror of a map structure I have in a different system.
The problem I have is that the codes are automatically generated, so they get the UID names, whereas really I'd like to present them as 'key=value', 'key=value', etc (ideally I'd like to present it as a table).
I've already created a custom control and added it to share-config-custom, and confirmed that the configuration is working correctly. What I'm not really clear on now is:
a) How to attach a javascript to the control so that I can process the association data.
b) How to get hold of the codes in javascript, and read their properties.
I'm just looking for a push in the right direction.
Thanks :)
One idea would be to use a form filter. Your form filter could iterate over the child references, fetch each child node, grab the data you want to display and then add one or more new properties with that data.
Then, your form control is hooked to the fields your form filter dynamically added to the form data. It can then read and display the data as needed.
Without a form filter I think you'd have to use JavaScript to parse the child association refs and use AJAX calls to fetch each child's node data, then format that as needed. The form filter idea would be less traffic from the browser.
I have an asp.net app that does ModelMapping from a submitted form. Today, I serialize the form and everything works great. I'm planning on nesting the current data structure (that the form maps to) within a class but the problem is that the class's name can vary.
Today I use Jquery's Serialize command on the form but now I need to prepend the new class name (and a '.') to the various inputs in the form.
Is there a simple way to tell Serialize to prepend a variable name? Alternatively, does anyone know an easily prepend a class on a set of variables that are serialized?
I am working on an application using JSF and Hibernate. The fields on the JSF form are backed by the Hibernate entities.
Ex:
value=#{bean.entity.value}
There is a Clear button which should empty all the fields on the form. There are 3 ways to do this:
Call a javascript function which loops through all the fields on the form and sets default value based on the type of field - text/checkbox/dropdown.
Call a bean method which creates a new entity (zeroes all fields) and assign the existing entities id to it. I hoped Hibernate would then update the row with that id, but instead it is creating a new row since it is a detached entity. Is there a way to fix this?
The most straight forward way is to call a bean method and manually set default values for all the fields in the entity. The problem with this is that there are too many fields and each time any change is made on the front end, I need to update the bean method accordingly.
Which is the most appropriate way to do this?
If no business is required to calculate the default value I would use JS function to reset fields. You will save one request to the server.
You could also generate JS function by JSF and get the default value from server side.
This won't solve the issue on page reload though.
I am working with NetSuite's server-side SuiteScript and need to access the display value of several custom Transaction Column Fields. The fields in question are each set up as type "List/Record" and are associated with existing Custom Lists.
Working in the NetSuite Script Debugger, I have inspected the values returned from nlapiLoadRecord('salesorder', orderInternalId). Looking at the Items in the resulting object (e.g. obj.sublists.item.line 1) I see that some of these List/Record custom fields provide both a number (the ID of the selected List entry) and a string (the displayed text value of the List entry), but other custom fields do not.
For example, I have two custom fields with IDs custcol1 and custcol2. These are both of type "List/Record". When the sales order is loaded, nlapiLoadRecord provides the fields "custcol1" (number) and "custcol1_display" (string) for custcol1, but only "custcol2" (number) for custcol2. I do not see any difference in the settings for these two custom fields, so it is unclear why one provides the string and the other does not.
I need to retrieve the string values for both fields. Is there a setting change I need to make so custcol2 will automatically return a "custcol2_display" value? Or is there another API call I can use to take the number value from "custcol2" and look up the associated string value in the underlying Custom List?
Try using record.getLineItemText('item', 'custcol2', linenum)
For debugging, I tend to use Firebug - it's a lot more effective than the NS debugger and quicker than logging statements for just testing things out.
I just noticed this is two years old, but I think you can put columnname.id to get the data value. It works for standard columns but not sure about custom ones.
One thing I have learned to use is the NetSuite debugger, I don't use it like a standard debugger but rather like the javascript console. Just paste in some code into the box and then debug it, it is great for seeing what the dang property values are and the data in them which seems to be a crapshoot in NetSuite.
This is for a web application using struts.
I have an array of objects in my Form that gets listed in a table. A user can add/edit/delete from the table. How would I send the changed table back to the Action class?
Will I need to create a string or array of strings, and parse that into an object? Is there a way that java/struts handles objects that are to be modified in the jsp? Or does this need to be cared for in javascript?
Struts binds the request parameters onto the ActionForm object based on name of the input.
actionFormObj.setBla(String x) { ... } matches <input name="bla"... in the form.
When you have related inputs, you can use maps or arrays for ActionForm properties and Struts is smart enough to treat them as well. See here.
Additionally, if your table contains read-only data that you switch to input when editing, you might have to deal with a lot of hidden fields in your form. If you still consider JavaScript as an option, you could create a POST request based on a JavaScript object (that you create with whatever data you wish from the table) and then use jQuery to send it. See here.
Indexed properties in struts, apparently takes care of this.