in reply to Re: Assign perl value in html link
in thread Assign perl value in html link

The tricky part is I dont really want to create a separe page for each field because i have over 20 of them.
I guess I can carry on all the hidden variables to edit page and also have this: <input name="edit" type="hidden" id="edit" value="[company]">
...BUT.... I can't figure out, how I would assign to what varibale [edit] needs to be assigned. How can I make EDIT equal to the varibale user wants to change, and then when they return to confirmation page how I make that field equal to EDIT?

Replies are listed 'Best First'.
Re: Re: Re: Assign perl value in html link
by dws (Chancellor) on Oct 04, 2002 at 19:55 UTC
    The tricky part is I dont really want to create a separe page for each field because i have over 20 of them.

    You can probably get by with a small number of generic edit pages, depending on the type of data you'll be editing. (If everyhing can be editing in a 20 character field, you can use a single edit page).

    Here's how it works: You already have a form that contains some number of visible and invisible fields. Add alternate "Submit" buttons labeled "Edit". Give these buttons the name of the field you want to edit (or some name from which the target field name can be derived).

    When one of these buttons is pressed, it submits the form. The CGI that catches the submit needs to recognize that an edit button was pressed (as opposed to an "I'm done with this page" button), and respond by producing an HTML page that includes a form. The form has an edit field for the field being editing, and all other form values hidden. The form action for this page is a CGI that handles the edit, and redirects back to something that will regenerate the page you started out on (e.g., your "confirmation" page).

      So there's no way I could write in JavaScript something like that to make it work?
      <a href="javascript:edit=formname.company">