• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

html forms question

rh71

No Lifer
mental blockage here...

I need it to show like this on webpage:

<input box>
button1 .. button2

Basically, user inputs a value in input box and decides what to do with it... addvalue or subtractvalue, for instance.

(Button 1 goes to add.cfm for processing input box value
Button 2 goes to subtract.cfm for processing input box value)

How do I get this to work ? Right now I have the following code but obviously I can't get to "myvalue" on either of the subsequent .cfm pages since it's not in the <form>.
 
Well, you could just post them to the same page and detect which button was clicked (forget exactly how to do that, but it's not hard). Another option is to use a tiny bit of javascript in the ****** events to change the form action before submission.
 
Originally posted by: kamper
Well, you could just post them to the same page and detect which button was clicked (forget exactly how to do that, but it's not hard).
Hmm, good point... URL parameter might work with it.

It's just that I know I've seen this done and I don't think any of that trickery was involved... I could be mistaken.
 
My suggestion is to have a single form with two buttons (of type button, not type submit). Have each of the buttons execute a different JavaScript function that modifies document.form.action.value to either add.cfm or subtract.cfm then submits the form.
 
I would have a single form with a hidden field that posts to a single page operation.cfm. Then when a button is clicked javascript executes that sets the hidden field to a known value (i.e 1 for add, 2 for subtract). The operation.cfm page checks the value of the hidden field and performs the requested operation. The benefit of this is less html and fewer files.
 
Back
Top