Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^6: Copy data from one form to another?

by fmogavero (Monk)
on Mar 11, 2005 at 21:28 UTC ( [id://438819]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Copy data from one form to another?
in thread Copy data from one form to another?

The first form is for searching the database. It can search on any of the fields and then return the results. i.e. type in a last name and the fields in the form get populated with the information from the database.

I wanted to incorporate a way from that page to modify the data and update the database.

The first submit button uses the same form to return search results. The other form would be for updating the database.

Replies are listed 'Best First'.
Re^7: Copy data from one form to another?
by jZed (Prior) on Mar 11, 2005 at 21:40 UTC
    Ok, great, now I understand what you want to do. Here's how I would do it. Forget about Javascript, that wouldn't help here. Don't use two forms, that confuses things (unless there are different fields in the search from and the edit form, in which case, this scenario would need to be modified).

    Make one form with two sumbit buttons both with the name "action" and one with a value "search" and the other with the value "edit".

    In your script, read param("action") and if it is "search", search the database and then redisplay the same form with the values filled in. If the action is "edit", update the database with the new information and then redisplay the same form again so they can search again. If there is no param("action"), that means the user is just starting so you display the same form, but with blanks.

    You only ever have one form, it just has different values filled in or blank depending on context. And you only have one script that does different actions with the database depending on the action param. Does that make sense?

      You Rock! Thanks. I don't know why I didn't think of the multiple thing.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://438819]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 05:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found