CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Java

 single speech marks in data

Print topic Send  topic

Author Message
robn

Posts: 70
Posted: 11/22/2004, 4:05 AM

I have current got a problem with Java code.

I have a pop-up window that allows for the selection of a user to be inputted into the main form to do this I use a link which has an onclick event as below:

onclick="SetUserValue('{trainee}','{traineefirst}','{traineesurname}');return false;"

The code works fine but the one problem I have is if one of the users names contains a single speech mark (i.e. O'Meara) then when it tries to display the list containing that users I get a Error: Expected ')' message appearing and if I try to select the link for the user I get the same message.

If I remove the onclick code it works fine, so I know that this is the problem.

Has anyone got a resolve for this?

any help would be much appreciated

regards

Rob

View profile  Send private message
robn

Posts: 70
Posted: 11/22/2004, 4:07 AM

Also to note I am using ASP with an SQL database
View profile  Send private message
Anton Hinxman
Posted: 12/14/2004, 9:11 AM

Yep, been there and seen it also in CCS demo, plus reported it as a problem to CCS a year or so ago. In the CCS demo you get this problem if you want a Mc'Donald to be a manager. The quote just makes a mess of the JavaScript (or rather the expansion of {field} into HTML/JavaScript for the page).

CCS did not have a fully satisfactory answer to this because no matter what you try to do expanding the field content into the JavaScript can always end with trouble.

So what's the answer?

Go back to the document object and use object id values for the three things you want to pass:

  
 <HIDDEN TEXTBOX bound to trainee> id=trainee  
 <READONLY TEXTBOX set to text converted from id to text of first name> id =traineefirst  
 <READONLY TEXTBOX set to text converted from id to text of surname> id =traineesurname  

In your JavaScript, used to open popup box of trainee student list, you can examine the document of IE and get the id value from the hidden and labelled control 'trainee':

trainee=""+document.getElementById("trainee").value

You can mess with all the parent document control values when the user makes a choice of student on the popup.

  
<script language="JavaScript">  
function SetOpenerValue(traineeFirst,traineeSurname,StudentId)  
{  
	if(window != null && window.opener != null) {  
	  	if(window.opener.document.the_record_is_here != null) {  
			  window.opener.document.the_record_is_here.studentid.value = StudentId;  
			  window.opener.document.the_record_is_here.traineefirst.value = traineeFirst;  
  
window.opener.document.the_record_is_here.traineesurname.value = traineeSurname;  
		}  
	  	window.opener.focus();  
		window.close();  
	}  
}  
</script>  
  

Note the_record_is_here is your record name.

You can update back to the parent object model in IE rather than 'fight' with the JavaScript parameter passing CCS has. If fields come from data raw and un-escaped out of CCS then you will always get some problems with the CCS method.

IMO you have to do all your work using the IE object model.


Hope that this helps.

Not as easy as it should be!

Regards

Anton Hinxman

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.