How to accept inputs from users ?
For example , I have a form and the inputs have to be filled by the user.? how do we do this in Umbraco ?
Can some one give me some pointers where i can get the information and the steps to do it..???
Depends what you need to do with the user input. What type of info is it? Do you want to save this as a node in umbraco? If so, use the Document.MakeNew() function. Full details on the function can be found at http://umbraco.org/apiDocs/ (Don't forget the trailing slash, or you'll get a 404)
Here's a code snippet to help you on the way:
[code]DocumentType type = DocumentType.GetByAlias("DocumentTypeAlias");
User user = User.GetUser(0);
int parentNodeId = -1;
How to accept inputs from users ?
How to accept inputs from users ?
For example , I have a form and the inputs have to be filled by the user.? how do we do this in Umbraco ?
Can some one give me some pointers where i can get the information and the steps to do it..???
Hi,
Depends what you need to do with the user input. What type of info is it? Do you want to save this as a node in umbraco? If so, use the Document.MakeNew() function. Full details on the function can be found at http://umbraco.org/apiDocs/ (Don't forget the trailing slash, or you'll get a 404)
Here's a code snippet to help you on the way:
[code]DocumentType type = DocumentType.GetByAlias("DocumentTypeAlias");
User user = User.GetUser(0);
int parentNodeId = -1;
Document newDocument = Document.MakeNew("Text", type, user, parentNodeId);
if (newDocument != null && newDocument.Id > 0) {
newDocument.getProperty("PropertyAlias1").Value = "Property1Value"; newDocument.Publish(user);
umbraco.library.UpdateDocumentCache(newDocument.Id);
}[/code]
Hope this helps.
Regards,
/Dirk
You can also have a look at Doc2Form and see if that works for your needs.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.