cancel
Showing results for 
Search instead for 
Did you mean: 

WebElements - Using Text Area to add notes

Former Member
0 Kudos

I am trying to use the WETextArea & WESubmit to allow a user to add notes to a notes table in my SQL Sever DB.

I have gone through the forums & user doc and thought I had all the bases covered, but I can't get it to work.

Ideally, the user will enter a text note and when they hit submit, the user's ID, the note text, a datestamp will be inserted into the table.

I have a crystal report (add_notes_rpt) with a command object that is simply this

DECLARE @NOW DATETIME SET @NOW = GETDATE()

INSERT INTO [TEMP_RPT_NOTES] VALUES ('011111', '{?NOTE}', @NOW)

SELECT 1

The sole prompt in the report is named NOTE - the report works as expected; when I run it standalone, I am prompted for the NOTE value and once I provide it, a row is added to the table.

Onto my Main Report: I have a formula that lays out the TextArea and Submit button (I cloned code Jamie posted in another post)

stringvar moreParams:= "drilldowntabs=hide&toolbar=hide&sReportMode=weblayout";

stringvar addpath:=WETargetPath ("rpt","CUID" ,{@CUID_add_notes},moreParams);

stringvar allelements :=

WETextArea ("NOTE", ElementDefault, ElementHeight, ElementWidth, Font,Validation, ValidationMessage) +

WEBreak(1) +

WESubmit("noteadd", "Button", " Add Note",WETargetPath ("rpt","CUID" ,{@CUID_add_notes},moreParams),font );

allelements + WEBuilder(allelements,3);

When I run my Main Report, the text area and submit button display beautifully. But, after entering a note and hitting the submit button, I am presented with the parameter prompt from my add_notes_rpt. (parameter name is NOTE)

The documentation indicates that naming the TextArea the same as the report parameter will cause the prompt to be satisified automatically with the text from the TextArea element, but it's clearly not happening. I've tried naming the TextArea as "?NOTE" and that doesn't work. I've tried embedding the WETargetPath statement in the WESubmit function call (instead of using a variab le).

Any ideas? I'm sure I'm missing something elementary...

Once I figure THIS out, the other goal is to pass a 2nd parameter (empl_ID) into the add_notes_rpt crystal report. Right now, to debug this issue, I am hardcoding the empl_ID into the command object script so that I only have ONE parameter to fulfill, but ultimately the Main Report will have a formula that contains the emp_id and I'd like to pass it into the add_notes_rpt in addition to passing in the Notes text. Assuming that the TextArea object will fulfill the NOTE paramenter, will I only have to code the 2nd parameter into the TargetPath function call?

stringvar moreParams :="lsSEMPLID="+

thanks in advance for the help! !

Accepted Solutions (0)

Answers (2)

Answers (2)

JWiseman
Active Contributor
0 Kudos

i have seen this behaviour before and it has usually come down to caching in your enterprise environment...especially when an iframe is used. logging in and out of enterprise can sometimes solve these issues. go to the CMC to the different reports involved and check to see that these reports are not being cached.

you may also wish to go to the File > Report menu in crystal reports and ensure that Save Data With Report is not checked.

for future debugging here's a couple of tips for webelements:

a parameter/prompt is only required on target reports and not on the report where you are passing the values from.

on your main report you only have to have a matching control name...these control names are case sensitive as well.

in the reports where you are passing values from, the control must be mentioned in the webuilder formula. if you don't see it in the url, then the formula containing the webuilder function is the cause. upon submit, the webuilder function goes through everything on the report and compiles a url containing any controls that are in your allelements list.

you should have your browser set so that you will see any errors in your browser status bar as that is useful for finding issues where the webuilder function can't find a control upon submit.

JWiseman
Active Contributor
0 Kudos

hello,

the first test for debugging an intercepted or non-functioning url would be to:

1) change your webuilder debug mode from 3 to 2...this way you can see what url is being generated

2) after you press the submit button, copy down the url in the alert box

3) in a new browser tab, try the url

what is the result?

jamie

Former Member
0 Kudos

Hi Jamie -

This is no longer an issue for me. (but I'm not sure why)

On my main report, I had 2 sets of controls:

a) a weTextArea and the corresponding submit button

b) an weIframe and a corresponding refresh button

The intent of the first set of controls was to allow the user to add a new NOTE and when he/she pressed submt, the note would be added to the notes table. The submit button would load the target report & pass to the report whatever text the user had entered in the TextArea as the NOTE parameter. The target report was simply powered by a command object that did an insert. It had one parameter named NOTE and I made sure the TextArea element name = NOTE as well.

The other set of controls allowed the user to view all of the existing notes that were in the notes table and, after adding a new note using the first set of controls, they could 'refresh' their view. The report loaded into the iFrame simply listed the content of the notes table. It accepted one parameter: the userID of the person running the report.

I verified that the submit button and the refresh button had different element names.

I was having problems because I couldn't get the link between the text area/submit button and the target report to work. The URL that was being built did NOT include the NOTE parameter so the report wasn't received the value entered by the user in the text area. Despite adding text and hitting the submit button, the prompt for the report wasn't automatically satisfied and I would get prompted by the crystal report for NOTE

The iFrame that displayed the content of the Notes table had been working fine, but I decided to change the debug mode on the refresh button from 3 to 2. That's when I noticed that the URL for the view report (generated for the 'refresh' button) contained the NOTE parameter from the WETextArea's submit button. (the view report doesn't contain a NOTE parameter) I double checked the control names and everything was unique.

It appeared that the refresh button for the iFrame control was intercepting the NOTE parameter from the TextArea control. (Weird) The submit button still was NOT getting the NOTE parameter.

I opened both the 'add note' and 'view notes' CR report and verified that only the Add Note report had a NOTE parameter. Then I removed the first set of controls from my main report, saved the report and without changing any code, I simply added the formula back onto the report. That's when it started working...

Once I did that, the resulting URL for the 'submit' button started correctly containing the NOTE parameter. However, the URL built for the viewer iFrame also still contains the NOTE parameter, populated with the text that was entered in the text area control. Since my viewer report doesn't have a NOTE parameter, it's just ignored, but I just wanted to described what I am seeing in case another user has issues. If my viewer report also had a NOTE parameter, I would have to rename it to something else so that its NOTE parameter didn't receive the wrong value.

thanks again,

Pam