cancel
Showing results for 
Search instead for 
Did you mean: 

Error when using WETextArea and WESubmitButton

Former Member
0 Kudos

<p>Hi again,</p><p>&nbsp;</p><p>I think I may have found a issue.</p><p>&nbsp;</p><p>if you have a form that has only a WETextArea and a WESubmitbutton that is submitting back to the same report ( with or with out database connection) I get a error message when I click the submit button of &#39;Getform&#39; not defined.</p><p>&nbsp;</p><p>I have replicated this in a stand alone report with no database connection just with a parameter and the 2 we elements that is posting back to the same report. </p><p>I found this while attempting to set up a screen to allow users to input data to the database using the WETextarea.</p><p>&nbsp;</p><p>Jon Roberts</p><p><a href="http://www.programmervault.com" title="www.programmervault.com">www.programmervault.com</a><br /></p><p><a href="http://www.dsi-bi.com" title="Decision Systems Inc">Decision Systems Inc </a> </p>

Accepted Solutions (1)

Accepted Solutions (1)

JWiseman
Active Contributor
0 Kudos

hey Jon,

getform not defined is usually thrown out when:

a)Â there is no formula containing a webuilder function on the reportÂ

b) the webuilder function formula is not on the same page as the rest of the controls

c) the formula containing the webuilder function is suppressed or has a height of greater than one line (that's the weird rule, in that all pass through html formulae must be one line in height only)

for more information see your User Guide in troubleshooting.

let me know of course of a) to c) are not the cause(s).

jw

Former Member
0 Kudos

<p>Hi Jamie,</p><p>&nbsp;</p><p>I tried you suggestions to no avail. I have e-mailed you a sample report that generaqtes the issue I am seeing. I have all the formulas in the same section and the controls render on screen just get the &#39;Getform&#39; undefined message when I click the submit.. </p><p>&nbsp;</p><p>Hope the sample helps</p><p>&nbsp;</p><p>Jon Roberts</p><p><a href="http://www.programmervault.com" title="Programer Vault">www.programmervault.com </a></p><p><a href="http://www.dsi-bi.com" title="Decision Systems Inc. - Business Objects Implimentation Vendor">Decision Systems Inc.</a> </p>

JWiseman
Active Contributor
0 Kudos

hey Jon,

you are not declaring your variables correctly...a variable declaration must be done such as

stringvar x:= "aaaaaaa";Â note the semi-colon.

if you use stringvar x = "aaaaaaa" without a semi-colon then you are doing a boolean check on the var.

jw

Former Member
0 Kudos

<div dir="ltr" align="left"> </div><div dir="ltr" align="left"> </div><div dir="ltr" align="left"> </div> <div dir="ltr" align="left"> </div> <div dir="ltr" align="left"><p><font face="arial,helvetica,sans-serif" size="1">Jamie,</font></p></div><div dir="ltr" align="left"> </div><div dir="ltr" align="left"><p><font face="arial,helvetica,sans-serif" size="1"><span class="256524521-05032007"><font color="#0000ff">I have corrected the Variable declaration and got the sample report to function; but I think I have found what is causing the issue. If the Name of the Parameter has a @ in it ( i.e. when the Parameter is coming from a stored procedure ) it will cause the report to generate a Getform not defined error. this can be simply shown by changing the Parameter Name from TestValue to @TestValue and update the text area name to reflect the @TestValue. when you publish the report and run it it generates the Getform error.</font></span></font></p></div><div dir="ltr" align="left"><p><font size="1">In the report for production I am unable ro remove the @ symbol from the parameter name as this is auto generated by Crystal from the Stored procedure</font> </p></div><div dir="ltr" align="left"> </div><div dir="ltr" align="left"> </div><div dir="ltr" align="left"> </div>

JWiseman
Active Contributor
0 Kudos

<p>hello,</p><p>any illegal characters that will affect the url must either be encoded or changed. as prompt names are used in javascript variable creation & to satisfy the url, the prompt name must be changed if it contains these characters...this is in the User Guide. the names of stored procedure parameters can be edited in crystal reports without affecting the stored procedure.</p><p>jw</p>

Former Member
0 Kudos

Hi Jamie

Does the WETextArea have the ability to control the maximum number of characters that can be entered into the text area? I see the maxlength option in WETextBox but wanted to apply it to the WETextArea

Thanks

JWiseman
Active Contributor
0 Kudos

hey AJ,

unfortunately you are completely out of luck on this one as Text Area does not have a max length property associated with it. <a href="http://www.w3.org/TR/REC-html32.html">http://www.w3.org/TR/REC-html32.html</a>

just kidding...this is a good idea (keep them coming) and pretty quick and easy to do...so...here's some code below to give you a validation method for WETextArea.

1) go to your Admin folder in webElements 2.1 and open up the WEValidator and replace its code with

// WEValidator 2.1 last revision March 8, 2007, JWiseman

Function (stringvar ElementName, stringvar Validate, stringvar Message)
stringvar output;

if validate > "" then

(
validate:= lowercase(validate);

if validate ="empty" then output :=
'if(isEmpty(getform.' + ElementName + '))' +Â
'{ ' +
'alert("' + Message + '"); ' +
'getform.' + ElementName + '.focus();' +
'return;' +
'}';

if validate in ["numeric", "number"] then output :=
'if(isEmpty(getform.' + ElementName + '))' +Â
'{ ' +
'alert("' + Message + '"); ' +
'getform.' + ElementName + '.focus();' +
'return false; ' +
'}' +
'if (!isNumeric(getform.' + ElementName + '.value)) ' +
'{ ' +
'alert("' + Message + '"); ' +
'getform.' + ElementName + '.focus(); ' +
'return false;' +
'}';

if validate in ["email", "e-mail", "email"] then output :=
'if(isEmpty(getform.' + ElementName + '))' +Â
'{ ' +
'alert("' + Message + '"); ' +
'getform.' + ElementName + '.focus();' +
'return false; ' +
'}' +
'if (!isValidEmail(getform.' + ElementName + '.value)) ' +
'{ ' +
'alert("' + Message + '"); ' +
'getform.' + ElementName + '.focus(); ' +
'return false;' +
'}';

if validate = "date" then output :=
'if(isEmpty(getform.' + ElementName + '))' +Â
'{ ' +
'alert("' + Message + '"); ' +
'getform.' + ElementName + '.focus();' +
'return false; ' +
'}' +
'if (!isDate(getform.' + ElementName + '.value)) ' +
'{ ' +
'alert("' + Message + '"); ' +
'getform.' + ElementName + '.focus(); ' +
'return false;' +
'}';

if validate = "integer" then output :=
'if(isEmpty(getform.' + ElementName + '))' +Â
'{ ' +
'alert("' + Message + '"); ' +
'getform.' + ElementName + '.focus();' +
'return false; ' +
'}' +
'if (!isInteger(getform.' + ElementName + '.value)) ' +
'{ ' +
'alert("' + Message + '"); ' +
'getform.' + ElementName + '.focus(); ' +
'return false;' +
'}';

if validate in ["check", "checked", "select", "selected"] then output :=
'if(!isButtonChecked(getform.' + ElementName + '))' +Â
'{ ' +
'alert("' + Message + '"); ' +
'return; ' +
'}';

if validate[1 to 6] = "value=" then
(validate:= validate[7 to length(validate)];output :=

&#39;if(isCertainValue(getform.&#39; + ElementName + &#39;,"&#39;validate&#39;"))&#39; +Â
'{ ' +
'alert("' + Message + '"); ' +
'getform.' + ElementName + '.focus();' +
'return;' +
'}');

if validate[1 to 7] = "length>" then
(validate:= validate[8 to length(validate)];output :=

&#39;if(isMaxLength(getform.&#39; + ElementName + &#39;,&#39;validate&#39;))&#39; +
'{ ' +
'alert("' + Message + '"); ' +
'getform.' + ElementName + '.focus();' +
'return;' +
'}');

"<!validator " + output + "><!|||>"
) else "";

2) now open WEFunctionLibrary and replace its code with

// WEFunctionLibrary 2.1 last revision March 8, 2007, JWiseman

Function ()

// functions for select all, clear all, reverse all buttons and links

&#39;function selectAll(cbList,bSelect) {&#39; <br />&#39;for (var i=0; i<cbList.length; i+)&#39; +
'cbList.selected = cbList.checked = bSelect&#39; <br />&#39;}&#39; <br />
&#39;function reverseAll(cbList) {&#39; <br />&#39;for (var i=0; i<cbList.length; i+){&#39; +
'cbList.checked = !(cbList.checked);' +
'cbList.selected = !(cbList.selected)&#39; <br />&#39;}}&#39; <br />

// VALIDATION FUNCTIONS

// function for numeric (float) input validation
'function isNumeric(sText){' +

&#39;var ValidChars = "0123456789.";var IsNumber=true;var Char;&#39; <br />&#39;for (i = 0; i < sText.length && IsNumber == true; i+) &#39; +
'{Char = sText.charAt(i); ' +
'if (ValidChars.indexOf(Char) == -1) ' +
'{IsNumber = false;}}return IsNumber;Â ' +
' }'
+
// function for integer input validation
'function isInteger(sTextB){' +
&#39;var ValidCharsB = "0123456789";var IsNumberB=true;var CharB;&#39; <br />&#39;for (i = 0; i < sTextB.length && IsNumberB == true; i+) &#39; +
'{CharB = sTextB.charAt(i); ' +
'if (ValidCharsB.indexOf(CharB)


== -1) ' +
'{IsNumberB = false;}}return IsNumberB;Â ' +
' }'
+
// function for non-null input validation
'function isEmpty(aTextField) {' +
'if ((aTextField.value.length==0) ||' +
'(aTextField.value==null)) {' +
&#39;return true;}else {return false;}&#39; <br />&#39;}&#39; <br />Â
// function for email input validation
'function isValidEmail(str){' +
'return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);&#39; <br />&#39;}&#39; <br />
// function for date input validation
'function isDate(str){' +
'var dateVar = new Date(str);' +
'if(isNaN(dateVar.valueOf()) ||' +
'(dateVar.valueOf() ==0))' +
'return false;' +
&#39;else {return true;}&#39; <br />&#39;}&#39;<br />
// function for radio button and checkbox validation
'function isButtonChecked(aSelection) {' +
&#39;var checkcount = -1;&#39; <br />&#39;for (var i=0; i < aSelection.length; i+) {&#39; +
'Â Â if (aSelection.checked) {checkcount = i; i = aSelection.length;}' +
'Â Â }' +
'if (checkcount > -1) return aSelection[checkcount].value;' +
&#39;else return false;&#39; <br />&#39;}&#39;<br />
// function for inappropriate value input validation
'function isCertainValue(aTextField, vTextField) {' +
'if (aTextField.value==vTextField){' +
&#39;return true;}else {return false;}&#39; <br />&#39;}&#39; <br />
// function for maximum input length validation
'function isMaxLength(aTextField, mLength) {' +
'if (aTextField.value.length>mLength){' +
'return true;}else {return false;}' +
'}'

3) do not add these to your repository quite yet as you'll want to test this to see if there's no nasty bugs or side affects.

4) in your WETextArea function you'll have a validation for maximum length, so your code will look something like

WETextArea ("tb", {?tb}, "1in", "2in", "", "length>16", "there are way too many characters here")

NOTE: this is for maximum length only and this will not do a minimum length at this time...should that need arise in the future i can create a validation for "length

Former Member
0 Kudos

Thanks Jamie. You truly are a Wise-man!Â

I'm going to throw one more validation question at you. Initially I had the validation on the text area for "Empty" prompting the user to enter some data if they hit the submit button without any text.

Can I have validation like "length>10 or Empty"?

JWiseman
Active Contributor
0 Kudos

<p>hey AJ, unfortunately multiple validations are not possible now so you&#39;d have to choose between which method you wished to use, empty or length. </p><p>perhaps the next build...</p><p>jw</p>

JWiseman
Active Contributor
0 Kudos

<p>p.s. on that last note...as webelements are custom functions and thus open source, please feel free to customize them in any way you want. remember to rename them so if you save them to your repo you don&#39;t overwrite the original stuff.</p><p>in your case you can try customizing the WEFunctionLibrary, in particular, change</p><p>// function for maximum input length validation<br />&#39;function isMaxLength(aTextField, mLength) {&#39; +<br />&#39;if (aTextField.value.length>mLength){&#39; +<br />&#39;return true;}else {return false;}&#39; +<br />&#39;}&#39; </p><p>to reflect a mutliple if then else for = to 0 or > than the maximum. this will however overwrite the end users ability to choose not to enter something.</p>

Former Member
0 Kudos

No problem Jamie. The max. length validation is good enough. Thanks for all your help. WebElements is a really great add-on to Crystal.

Answers (0)