Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit form without refresh

Status
Not open for further replies.

stewartwebb

Programmer
Jan 6, 2004
92
0
0
GB
Hi,

I'm not sure if this is possible. Basically there are 2 tables on the left of the screen and the right. When the user clicks one of the tasks in the left table at the moment the page is submitted and refreshed which takes a second or so but that task is then added to the right table. What our client wants is to click the task in the left table and dynamically add it to the right table which is fine. The problem is for each task they add i'll need a hidden field to stored other information about that task they've just added. In our system (we use CGI tags) there is a problem where if you read into the program more than about 100 fields you get an error and so reading in 100+ hidden fields is a problem. So what i'm trying to do is some how dynamically move the task from left to right (which I can do) but then submit the task and task information back to the program in the background but not refresh the page. Once the user has added all the tasks they then click a complete button which will refresh the page. The user will probably add more than 100 tasks at a time which is why i'm thinking of another way round it.

Thanks in advance
 
If you need to do operations on the page without submitting it, you need to look into JavaScript (forum). Of course, there are also much smoother solutions than using hidden fields, for example using session variables. To inquire about that, look into whatever server side language you are using. As for HTML, it cannot help you, since it is just a markup language.
 
You'll need to use either frames, iframes, or something like AJAX for this. If the latter, you should ask in the JavaScript forum (forum216) - in fact, another member has just posted a lot of AJAX-related links there.

Are you OK with using frames / iframes? If not, you will probably have to use JS if you want to avoid a page refresh.

Hope this helps,
Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
If I understand you correctly, you're trying to replicate the set-up used in, say, email address book dialogues, where you have a list of available choices, a list of choices made, and buttons to shuttle choices from one list to the other.

It should be possible to replicate this behaviour using Javascript, with an onSubmit event looping through the "chosen" <select> box and concatenating them into a hidden field. Be careful though, if your page is aimed at the general public, they may have JS switched off on their browsers.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
I have some javascript code to create that kind of two-list selection, but it only works in IE (it was for internal use). I haven't had the time to try to make it work under FF, but if you want to try you can have the code. It's pretty easy to use.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Personally, i'd use PHP and have an echo on the other side of the page, using iframes.

for example:

Code:
<iframe src="left.php" name="left" id="leftFrame">
Sorry, your browser does not support iframes.
</iframe>

and obviously you can add other attributes, like postitioning etc. then simply on the other side of the page put:

Code:
<iframe src="right.php" name="right" id="rightFrame">
Sorry, your browser does not support iframes.
</iframe>
[code]

and when you submit your form in 'leftFrame'(left.php) it will post the data to 'rightFrame' (right.php) where you have an echo to display the text.

[code]
<? php
//rightFrame echo system....i think
echo var = string[1]
           string[2]
           string[3]
?>

then you need to put in the post variables which i cant remember, but they're probably easy enough to get hold of.

the echo should work though, and obviously you repeat as many times as required.

-----
Best Regards
Rob Kelsey
________________________________________________________________
My computer makes me say: "Somebody stop the world, I want to get off!
 
tsdragon,

Is it ok if I have the code, please. The client only uses IE.

Thanks.
 
the php code?

-----
Best Regards
Rob Kelsey
_________________________________________________________________
My computer makes me say: "Somebody stop the world, I want to get off!
 
It may be a little late in the game for you on this one... but I created a full demo that shows 4 nested drop-downs that "auto updates" based on what you select. I bet that if you looked closely at the code example I posted you would be able to extrapolate what you need from it.

thread216-1081225

Let us know how you go with this one!

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top