FoxPro Programming
dropdown menu
Gravatar is a globally recognized avatar based on your email address. dropdown menu
  Nechama
  All
  Jan 4, 2017 @ 08:44am

The following add a column in my grid:

loConfig.AddColumn([=Process.Printts()],[Select Timesheet to print])

I have the following code in function printts that calls a jquery function:

<select id="+lcId+[" name="]+lcId+["  onchange="wlgts(this.value+'*'+this.name)">
<option>Select<option>
<option>Week 1<option>

Here is the jquery function:

TEXT TO lcHtml NOSHOW TEXTMERGE 
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script>

function wlgts(val)
{
	$.get("wlgonets.wp",{ cohort: val });
}
</script>
ENDTEXT

response.write(lcHtml)
ENDFUNC

function wlgonets
thisid = Request.Params("id")
if thisid = [Select]
return
else
***do whatever needs to be done to create a file
Response.DownloadFile(lcPdfFile,"application/pdf")
endif 

I have two issues: One is that if the user selects "Select", I don't want it to downloadfile. Putting a "return" causes a blank page to appear in the browser. How can I get it to behave the same way as if I was downloading a file, without the file dialog appearing?

My other question is: Because the function is run from dropdown menu only if "onchange", meaning if user changes the option, if user selects the same option that was already selected, it won't run. How can I get it to run anyway?

Thanks in advance and for all your assistance.

Gravatar is a globally recognized avatar based on your email address. re: dropdown menu
  Nechama
  Nechama
  Jan 5, 2017 @ 10:24am

I figured it out.

© 1996-2024