Web form not saving on edit

Urgent!!!

I have a form for the web with validation code in OnSubmit. I can successfully create a document over the web and the validation code fires exactly as I want it to. However, when I go back to that document and edit it over the web, make change to it and click on the Save button (which has @ formula for filesave & fileclosewindow) I get the following error and the form does not save:

Errors on this webpage might cause it to work incorrectly. Details as follows:

‘MRRequester.options’ is null or not an object

Here’s my validation code in the OnSubmit event which refers to the object MRRequester which is a dialogbox field.

var f = document.forms[0]

var defaultChoice = “Select One”;

var fldVal;

fldVal = f.MRRequester.options[f.MRRequester.selectedIndex].text;

if (fldVal == defaultChoice) {

alert (“Please specify the requesting supervisor.”);

f.MRRequester.focus();

return false;

}

if (f.MRTroop.value == “”) {

alert (“Please specify the troop number.”);

f.MRTroop.focus();

return false;

}

fldValP = f.MRPod.options[f.MRPod.selectedIndex].text;

fldValS = f.MRSection.options[f.MRSection.selectedIndex].text;

fldValC = f.MRCell.options[f.MRCell.selectedIndex].text;

if ((fldValP == defaultChoice) && (fldValS == defaultChoice) && (fldValC == defaultChoice)){

alert (“Please specify either pod, section or cell/door area.”);

f.MRPod.focus();

return false;

}

if (f.MRIssue.value == “”) {

alert (“Please specify the description of issue.”);

f.MRIssue.focus();

return false;

}

Subject: Get rid of “options” keyword

Use for instance :

f.MRRequester[f.MRRequester.selectedIndex].text

instead of

f.MRRequester.options[f.MRRequester.selectedIndex].text

and it should work

Renaud

Subject: web form not saving after edited

Thank you for your response … tried the modified validation code. Everything works fine until I go back and try to edit the form and save it, resulting in following error in iexplorer browser.

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2)

Timestamp: Fri, 20 Nov 2009 17:41:06 UTC

Message: ‘MRRequester.selectedIndex’ is null or not an object

Line: 62

Char: 1

Code: 0

URI: http://scmail.co.sebastian.ar.us/jailmain.nsf/afce80f5eb50f8858625765100699e60/4541950880527e7f8625767400612594?EditDocument

Message: ‘MRRequester.selectedIndex’ is null or not an object

Line: 62

Char: 1

Code: 0

URI: http://scmail.co.sebastian.ar.us/jailmain.nsf/afce80f5eb50f8858625765100699e60/4541950880527e7f8625767400612594?EditDocument

Subject: update but still need input please

Once I realized that onsubmit event was being invoked by the @command([filesave]), I created a separate save button using js code.

I would still like to know how I could not have the validation code fire if the document is just being edited or if there are fields that need to be validated when certain [roles] edit a document.

If anyone has some thoughts on this … please help. Thanks!

Subject: Check hide-whens

Dear Tommy

Are you sure that you are not hiding the field you are trying to validate once the document has been saved at least once? Or could it be hidden due to other fields that the user has selected?

This might cause the field to ‘not exist’ or the field to no longer be a valid select object.

HTH

Melissa