Date:  12/30/2002 01:49:11 PM Msg ID:  001171
From:  Gene Gerard Thread:  001170
Subject:  Re: Submit button problems

Hi Alan,

Getting past this methodology is the first step in my opinion to getting to what you want to do.

Basically, an .FWX page would be designed with FoxPro code at the beginning of the entire script that is used to respond to trapped events. Lets call it the 'FW Function Area' or FWFA for short.

The events are trapped in the <FORM> ... </FORM> wrapper.

Let's say you want to capture input from an entry field or a selection list. The Submit button in the Form wrapper tells the program to take that value and pass it to the FWFA. In the FWFA, the is code set up that starts with something like this:

  IF LOWER(Request.Form('FormName')) = 'your_page_name'

This tells the program to continue and search for the needed functionality like:

  DO CASE
    CASE Request.Form('your_page_name_action') = 'Cancel'" + CHR(13)
        Server.Transfer('your_main_page.fwx')" + CHR(13)

To see how this is accomplished in an actual example, look at the code in the CONTACT samples that FOXWEB provides.

Now . . . how do you pass the selected values to the next page?

There are probably a number of ways of doing it but since most of my pages are 'dynamic', i.e. 'built on the fly', I have one of these CASE operations call a function with those passed variables that creates the next page.

The function can be part of the original calling page but that make it cumbersome. a call in the first line of the FWFA like:

  SET PROCEDURE TO myprocs.prg

will allow you to put most of your functions/procedures into a single program . . . and then they can be called with a line like:

 CASE Request.Form('your_page_name_action') = 'Select Billing Date'
  M.dt = Request.Form('dropDownaDate')   && checks for selected date
  =makeMyBillingDatePage(M.dt)               && calls your function to build page
  Server.Transfer('myBillingDatePage.fwx')  && connects to page

How you have your function 'makeMyBillingDatePage' create the page is of your own design.

A sample methodology can be found in my reply to Don Dascher's post:

   'CODING TECHNIQUES/Positioning of data entry fields'

My new website at www.datatrack.net should have all of this functionality installed sometime during the first week of the new year.

The site will have 26 potential pages but 23 of the will be built dynamically (on the fly) from passed data.

I hope this helps.

 

Regards,

Gene

 


Sent by Alan Harris-Reid on 12/27/2002 09:00:13 AM:

I want to have a submit button on a form, and when submitted, I want to be able to retrieve data from the called page as to whether it was called from the button press or via another method (eg. if 'enter' was pressed).
Ideally I would like to use a button created using [input type="submit" name="submit" value="Report"], as the name/value pair are posted to the next page.  The problem with the resulting button is that I cannot see any way to change font, size or color of button text, so I am limited to a very boring-looking button.  Is there any way around this?  I tried changing the font attributes of the table cell containing the button, but the button still looked the same.

To solve the appearance problems I could create the button using [button]...[/button] tags, but the problem this is that the posted value is always the same, whether the button was pressed or not, so I cannot tell if the button was pressed to access the next page.  Also, the posted value contains all sorts of useless information regarding font size, type, etc. - I only want the value="..." text.

Any help would be appreciated.  I would prefer a plain HTML solution if possible, but failing that, a Javascript solution would do.

TIA,
Alan

PS. I have used square brackets only for display purposes so that the text in-between is not interpreted as HTML!