Collect data from a User - Validation Bug
Hi,
I use the action "Collect data from a User". I add a new field of the type Choice, the next step I write two choices:
Approved
Rejectedand configure it:
Default value is blank
Display as: Radio Buttons
uncheck Allow Fill-in choices
uncheck Allow blank valuesClick Finich button
When the task is created I need to choose among Approved or Rejected, however if it be not chosen any alternative the validation doesn't work.
If I have a field text the validation works perfectly.
Is there a bug in validation form when the field is a "Choice type" ?
Please help-me.
Réponses
I confirm that, there is a bug so validation does not fire in a collect data generated form.
I've implemented a custom JS validation before form submit, based on this Rob's post:
(My choice/approval field is a DropDown)
Code Snippetfunction ValidateApproval(fieldName)
{
var x = getTagFromIdentifierAndTitle('select', 'DropDownChoice', fieldName);
if (x.value == '')
{
alert('You must choice an approval value!');
return false;
}
return true;
}And so, in submit button, before postback
Code Snippet<INPUT onclick="javascript: if(ValidateApproval('ApprovalField')) {ddwrt:GenFireServerEvent(concat('__update;__workflowTaskComplete={',ddwrt:EcmaScriptEncode(string($Id)),'*',ddwrt:EcmaScriptEncode($ListName),'};__commit;__redirectsource;__redirectToList={',ddwrt:EcmaScriptEncode($ListName),'};'))}" type="button" name="btnMarkSubmited" value="Complete Task">></INPUT>
HTH
Massimo
Hi Massimo,
I already hoped to be a bug. Thanks for help!
How I have a radio button I made another function!
Code Snippetfunction checkRadio()
{
var theForm = document.forms[0];
for (var i=0; i < theForm.elements.length; i++)
{
if (theForm.elements[i].type == "radio")
{
if( theForm.elements[i].checked )
{
return true;
}
}
}
alert("Por favor selecione Aprovado / Rejeitado.");
return false;
}so, in submit button, before postback
Code Snippet<input type="button" name="btnMarkSubmited" value="Gravar" onclick="javascript: if(checkRadio()) {ddwrt:GenFireServerEvent(concat('__update;__workflowTaskComplete={',ddwrt:EcmaScriptEncode(string($Id)),'*',ddwrt:EcmaScriptEncode($ListName),'};__commit;__redirectsource;__redirectToList={',ddwrt:EcmaScriptEncode($ListName),'};'))}"></input>
Thanks a lot Massimo!
Att
Toutes les réponses
I confirm that, there is a bug so validation does not fire in a collect data generated form.
I've implemented a custom JS validation before form submit, based on this Rob's post:
(My choice/approval field is a DropDown)
Code Snippetfunction ValidateApproval(fieldName)
{
var x = getTagFromIdentifierAndTitle('select', 'DropDownChoice', fieldName);
if (x.value == '')
{
alert('You must choice an approval value!');
return false;
}
return true;
}And so, in submit button, before postback
Code Snippet<INPUT onclick="javascript: if(ValidateApproval('ApprovalField')) {ddwrt:GenFireServerEvent(concat('__update;__workflowTaskComplete={',ddwrt:EcmaScriptEncode(string($Id)),'*',ddwrt:EcmaScriptEncode($ListName),'};__commit;__redirectsource;__redirectToList={',ddwrt:EcmaScriptEncode($ListName),'};'))}" type="button" name="btnMarkSubmited" value="Complete Task">></INPUT>
HTH
Massimo
Hi Massimo,
I already hoped to be a bug. Thanks for help!
How I have a radio button I made another function!
Code Snippetfunction checkRadio()
{
var theForm = document.forms[0];
for (var i=0; i < theForm.elements.length; i++)
{
if (theForm.elements[i].type == "radio")
{
if( theForm.elements[i].checked )
{
return true;
}
}
}
alert("Por favor selecione Aprovado / Rejeitado.");
return false;
}so, in submit button, before postback
Code Snippet<input type="button" name="btnMarkSubmited" value="Gravar" onclick="javascript: if(checkRadio()) {ddwrt:GenFireServerEvent(concat('__update;__workflowTaskComplete={',ddwrt:EcmaScriptEncode(string($Id)),'*',ddwrt:EcmaScriptEncode($ListName),'};__commit;__redirectsource;__redirectToList={',ddwrt:EcmaScriptEncode($ListName),'};'))}"></input>
Thanks a lot Massimo!
Att
Hi
I have a same requirement. I am also using Radio Buttons Approve / Rejece in my WorkFlow Taks
But After selecting the Option on Complete Task I want to update the Table in SQL 2005 Database
can any one help me in this
Thanks in advance
Regards
André Rentes wrote: Hi Massimo,
I already hoped to be a bug. Thanks for help!
How I have a radio button I made another function!
Code Snippetfunction checkRadio()
{
var theForm = document.forms[0];
for (var i=0; i < theForm.elements.length; i++)
{
if (theForm.elements[i].type == "radio")
{
if( theForm.elements[i].checked )
{
return true;
}
}
}
alert("Por favor selecione Aprovado / Rejeitado.");
return false;
}so, in submit button, before postback
Code Snippet<input type="button" name="btnMarkSubmited" value="Gravar" onclick="javascript: if(checkRadio()) {ddwrt:GenFireServerEvent(concat('__update;__workflowTaskComplete={',ddwrt:EcmaScriptEncode(string($Id)),'*',ddwrt:EcmaScriptEncode($ListName),'};__commit;__redirectsource;__redirectToList={',ddwrt:EcmaScriptEncode($ListName),'};'))}"></input>
Thanks a lot Massimo!
Att
Where do you place this code? Every time I put the code in one of my aspx files I get an error message saying the web part has a problem. Is this even possible to use when creating workflows within Office SharePoint Designer?
Matt
Hi Matt, try to put the js function in a script tag inside PlaceHolderMain at the top of page:
Code Snippet<asp:content id="content2" runat="server" contentplaceholderid="PlaceHolderMain">
<script type="text/javascript" language="javascript">
function ValidateApproval(fieldName)...
</script>
...
The call to this function at the bottom of the form instead, as I've highlited in my first reply.
This workaround IS for workflows (collect forms) generated by SPD
HTH
Massimo
Thanks Massimo you solve all my problems.

- Where would I need to change? I cant get this to work

