Node Name generation when user saves a new created node
Hi,
I have some content types with first and last name for example. When the user creates and saves a new content and did not entered any node name, the backend gives an error as the node name is mandatory.
I would like to create a node name automatically based on first and last name. Is there a way to do this ? Thanks for any suggestion or sample :)
I managed to update the nodename within a certain editor.
But at that point apparently the nodename is already invalidated in case it has not been filled in. So The node is not submitted, but somehow the validation is set to OK. If I submit again then it is ok.
Is there any event I can start, so that the validation or the submission occurs again. I could hope the editorState could have some function to validate the form again ?
function checkNodeName() {
var currentEditorState = editorState.getCurrent();
if (currentEditorState.contentTypeAlias == "pressContact"
|| currentEditorState.contentTypeAlias == "cabinetMember"
|| currentEditorState.contentTypeAlias == "genericMember"
) {
var fn = currentEditorState.tabs[0].properties[0].value.values["en"];
var ln = currentEditorState.tabs[0].properties[1].value.values["en"];
if (fn && ln) {
currentEditorState.name = fn + "-" + ln;
}
editorState.set(currentEditorState);
}
Node Name generation when user saves a new created node
Hi,
I have some content types with first and last name for example. When the user creates and saves a new content and did not entered any node name, the backend gives an error as the node name is mandatory.
I would like to create a node name automatically based on first and last name. Is there a way to do this ? Thanks for any suggestion or sample :)
Thanks
Laurent
I managed to update the nodename within a certain editor. But at that point apparently the nodename is already invalidated in case it has not been filled in. So The node is not submitted, but somehow the validation is set to OK. If I submit again then it is ok.
Is there any event I can start, so that the validation or the submission occurs again. I could hope the editorState could have some function to validate the form again ?
If you get better ? but actually it's doing what it should :-)
is working on a reply...