473,398 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

javascript back drops file value

Hi

I am using input type file to upload a logo for a form using php.
Now i have a preview button and if the user uses the browse button to select
an allowed image (input box contains say c:\images\image1.jpg) when
previewed the code displays the image and any text in a textbox ok.
Using <input type="submit" value="<< Back"
onClick="javascript:history.back();"> the form keeps all inputs but looses
the c:\images\image1.jpg

is there a way round this or do i have to live with it?

Mark

Jul 24 '05 #1
2 4162
In article <42**********************@news.zen.co.uk>,
us****@NOSPAM.obantec.net enlightened us with...
Hi

I am using input type file to upload a logo for a form using php.
Now i have a preview button and if the user uses the browse button to select
an allowed image (input box contains say c:\images\image1.jpg) when
previewed the code displays the image and any text in a textbox ok.
Using <input type="submit" value="<< Back"
onClick="javascript:history.back();"> the form keeps all inputs but looses
the c:\images\image1.jpg

is there a way round this or do i have to live with it?


The fact that the fields stay filled in at all is browser-dependent.

To ensure everyone gets to keep the values, take care of it on the server
side by not using history.back and instead use a link that goes to that page
with URL params (or a form with post, or session vars, or whatever) then use
PHP to fill in the values.
--
--
~kaeli~
Abdicate (v.), to give up all hope of ever having a flat
stomach.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 24 '05 #2
"kaeli" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <42**********************@news.zen.co.uk>,
us****@NOSPAM.obantec.net enlightened us with...
Hi

I am using input type file to upload a logo for a form using php.
Now i have a preview button and if the user uses the browse button to select an allowed image (input box contains say c:\images\image1.jpg) when
previewed the code displays the image and any text in a textbox ok.
Using <input type="submit" value="<< Back"
onClick="javascript:history.back();"> the form keeps all inputs but looses the c:\images\image1.jpg

is there a way round this or do i have to live with it?
The fact that the fields stay filled in at all is browser-dependent.

To ensure everyone gets to keep the values, take care of it on the server
side by not using history.back and instead use a link that goes to that

page with URL params (or a form with post, or session vars, or whatever) then use PHP to fill in the values.
--
--
~kaeli~
Abdicate (v.), to give up all hope of ever having a flat
stomach.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace


Good idea! I'll simple have it post the data back and as you say have php
fill in the values.

Mark

Jul 24 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dan glenn | last post by:
hi. I want to code a 'preview' function into a guestbook entry page. I can do it with a button that posts, bringing up a whole new page showing a preview of what has been entered, and then the user...
7
by: Trvl Orm | last post by:
I am working with 2 frames, Left and Right and the main code is in the left frame, which has been attached. Can someone please help me with this code. I am new to JavaScript and can't figure it...
21
by: strutsng | last post by:
<input type="file"> only allows the user to browse for files. How about "browse for folder" dialog? Can html/javascript do that? I couldn't find any syntax for that. If not, please advise what...
7
by: moondaddy | last post by:
I want to dynamically create a JavaScript file and cache it on the client for re-use. I know how to write javascript to a web page from the code behind, but I don't know how to actually create a...
14
by: Rich | last post by:
I am converting my enterprise solution from VS 2003 (.NET v1.1.4322) to VS 2005 (.NET v2.0.50727). The entire solution uses serveral technologies - Windows Server 2003 (AD, SQL Server 2000, IIS,...
25
by: acemtp | last post by:
Hello, I would like to show you a new collaborative website for javascript programmer. It's quite hard to know if some specific code you wrote will work on all browsers, and if not, why it...
3
by: anthonybrough | last post by:
I have an asp page that has a form to collect user data in a form. when the user clicks submit the input is validated. If any fields are not acceptable the user clicks on a button to go back to...
4
by: =?Utf-8?B?R1ROMTcwNzc3?= | last post by:
Hi Guys, thanks for your help yesterday, I've got one more question, then I think I'm done for now,... Is it possible to insert recordset data in a javascript, for instance I have a javascript...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.