cancel
Showing results for 
Search instead for 
Did you mean: 

Aikau Dynamic form field value

svalle
Champ in-the-making
Champ in-the-making
Hello,

We have a custom content type and we would like to develop a custom form to create objects of this type. One of the metadata properties is an ID that is automatically generated by a call to a custom webscript (kind of database sequence). This field is not editable by the user but we would like to display it in the custom dialog before creating the content. How can we achieve that using Aikau? Is there a way to pre-populate form fields with dynamic values like this ID?

Thank you in advance
Sergio
3 REPLIES 3

kavilash23
Champ on-the-rise
Champ on-the-rise
Hello,

You could create a behaviour attached to your custom Type and use the onCreate policy to populate your field.

svalle
Champ in-the-making
Champ in-the-making
Thank you Kavi for your response. This is an interesting alternative.

ddraper
World-Class Innovator
World-Class Innovator
As an example of extending an existing widget you might want to look at the alfresco/forms/controls/RandomValueGenerator which extends the standard TextBox form control to generate a UUID as its value (if a value has not been provided). If you want the ID to be generated by a WebScript then you could extend an existing form control (as the RandomValueGenerator does) but instead of generating ID on the client you could make an XHR call to the WebScript to get the ID. Alternatively if this form is being presented on a new page then (rather than as a dialog) then you could generate the ID within the JavaScript controller for the page.