Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enforcing required fields on a webform HTML view 1

Status
Not open for further replies.

jkurker

Programmer
Feb 18, 2009
14
US
I found article 3499673 on the Knowledge Center that describes how to enforce required on a webform HTML view. The solution is to create a function (among other things) and reference each attribute to be required (see below). It seems to work but I'm not sure how to refer to a date field, eg. .value, .selectedindex. Can someone help? Thanks.

function checkRequiredAndSubmit()
{
if ( document.myForm._1_1_2_1.value == '' )
{
alert( 'You must enter a Name.' );
}
else if ( document.myForm._1_1_3_1.value == '' )
{
alert( 'You must select one or more States.' );
}

else if ( document.myForm._1_1_7_1.selectedIndex == 0 )
{
alert( 'You must select a Reviewer.' );
}
else if ( document.myForm._1_1_5_1.value == '' )
{
alert( 'You must choose a Manager.' );
}

else
{
document.myForm.submit();
}
}
 
this is standard Javascript validation events rather than Livelink specific ones, so the JS forum ( among others, should be able to provide help.

If you can provide more information on what your validation requirements are then we should be able to create the JS for you.

Greg Griffiths
Livelink Certified Developer & ECM Global Star Champion 2005 & 2006
 

When you define a form template for eg "MyText" if you look at your status bar,livelink will show what the integer representation for it.

document.myForm._1_1_2_1.value

Document is javascript notation for the document or in this case the html view
MyForm is the name of the form as signified by <FORM ---

_1_1_<the integer value in your formtemplate>_1.value

if you look carefully at the javascript view source the
document gets submitted to a livelink request handler

it will look something like ?func=

that is how livelink receives the parameters form the form as Greg points out is standard protocol how web forms work.

So your date object has all the necessary javascript code but only thing what I would suggest is on form submission the date is converted to oscript internal date.

Put alert statments or document.writeline when you are debugging forms.





Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937

Certified OT Developer and probably certfiable,Livelink ECM Champion 2008
 
Thank you both. I am new to HTML and JAVA and in the past have only the regular Livelink attributes. This is a whole new world!
 
No Problem. We, and others, are happy to help, if you post more information we should be able to get you something working quickly that meets your needs.

HTML and Javascript are well documented on the web and in books etc so you should have plenty of resources available to help you learn them to the level you need.

Greg Griffiths
Livelink Certified Developer & ECM Global Star Champion 2005 & 2006
 
I need to learn so I will keep plugging.

I do have another question though. I created a few views and they're working okay. But I ran into something I think is unrelated to the view. The last step in my workflow does not have to enter anything on the form. At that point any form data needed has been added. However, when I click Send On at the step, I get the error:

Livelink Error: Error performing Workflow operation.
[Form Form Testing Form is required].

If I click Apply on the Form and then Send On, it works okay.

 
at that step double click and enable the form for the step.When creating your workflow and when you added the form
you must have selected "Mandatory Form".So the workflow step
scripts are going by that,it is expecting that to be there.

What I am saying has to be done on the workflow map unless you know advanced workflow management and suspending and re-drawing the map.

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937

Certified OT Developer and probably certfiable,Livelink ECM Champion 2008
 
There is a check box when applying the form to the map that says "required form." If that is deselected there is nothing stopping the initiation of the workflow. The code for required fields only works if you click apply on the forms page.
 
Once again I am confused .

Work Flow is-Map+Attachments package+attributes package+comments package+Forms package.

Forms are based on Form Templates to which you add 'Views' to aesthetize the look and feel and to supply javascript
business rules.The validations that you describe are plain client side the livelink server does not know it.It is all happenning in the client browser.


When you create a workflow map and said I am going to make
the form mandatory then every step expects that form to be shown,that is what I call the package.I suspect that the last step does not have it enabled.

That setting has "NOTHING TO DO WITH CLIENT JAVASCRIPT VALIDATION" which is the button and the assorted stuff.

I am not sure what you mean by this
If that is deselected there is nothing stopping the initiation of the workflow.
In vanilla livelink any body who has See/See Contents on the workflow map object id can initiate the workflow form or no form.
My guess is that you are kind of making the workflow initiate from the form and wrongly understanding that this setting is what makes it run.

I could be completely wrong as well...
because OT Workflow is the one that magically appears in myriad forms in companies.....






Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937

Certified OT Developer and probably certfiable,Livelink ECM Champion 2008
 
Thanks for your patience and sorry for the confusion. I was able to enforce the required fields using the views but it doesn't get triggered unless the user clicks Apply on the Form.

What I ran into is outside that. The last step in my test workflow does not require any data to be entered but Livelink still wants that step to enter something. If I don't select the checkbox Required Form, a workflow can be initiated without entering anything in the form. If it is checked, it seems that Livelink wants something entered at every step or at least have the forms apply button clicked before you can send on at that step.

I hope that makes sense. Thanks for your help.

 
I think I understand your predicament.You have created a workflow map,you have created a form template and views to go with it with client validation routines,you have selected the 'Required form' so that this form/view shows up on the initiate step of workflow.Right now the map will not complete because you don't think the form is necessary at the step but livelink thinks so because of the 'Required Form'.I think that if you double click the last step and put the form there using the forms tab the error will go away.you could provide a "Read Only" view at this step so that users will not be able to alter form data.

There is yet another way you can do this without using the
'Required Form' setting.This is acheived by using a form to initaiate the workflow rather than clicking on the "Initiate" url of wf map object.

Here are the steps I use to acheive that.
Step 1:Create Form Template
Step 2:Create Form view with any custom javascript validation.
Step 3:Create workflow map.
Step 4:Add Form template in Step 1 to this workflow map and make sure Form is shown "double click each workflow pallete step and select the "view" you want displayed"
Step 5:Create a Form from the form template in step 1.In the wizard tell it that you want to "Initiate A workflow".In the next wizard point it to the workflow map in step 3
Step 6:Click the form view will be shown with any custom javascript validation.If users don't enter something the submit won't happen(this is your code).If all is kosher the workflow will be initiated.
Step 7:In the start step of the workflow you clear off "Prompt for title at initiation" and authenticate and what others you do not need otherwise you will see the standard workflow interface or else you will see "your workflow is initiated".Newer versions of workflow allows you to expose the "attachments" there is a button like that required form in the forms interface in the workflow


Like I said the workflow/forms package is so versatile that every day people find different ways of "automagic" with livelink workflow.

Otherwise post your workflow in the KB and I will take a look at it as time permits.


Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937

Certified OT Developer and probably certfiable,Livelink ECM Champion 2008
 
This is great. I got it to do what I wanted it to. Thanks again for your help!
 
I finally spent more time on this and re-reading your note, I realize I misunderstood. You're suggesting having the form initiate the workflow. When I try to do that I have a few issues:

First, the workflow does not initiate so I don't know if there is some configuration needed to make this happen.

Second, I would like the users to enter a workflow name.

Third, when I open the form, the data from the last entry is still there.

You mentioned there was a way expose attachments?

Thanks.
 
In this link the venerable Bhupinder Singh of OpenText has a tutorial that shows you how to do it.WFDesign1,2 &3 are also highly recommended


Let us know if that helps

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937

Certified OT Developer and probably certfiable,Livelink ECM Champion 2008
 
Thanks. I was missing the step "Submit Data." I'm not sure having the form initiate the workflow wll work for my submitting audience unless I could somehow automate the Submit Data step so when they click Apply, the workflow initiates.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top