473,396 Members | 1,892 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,396 software developers and data experts.

disabling button click

I have form with one submit button.
All i want to create is to allow user to make JUST ONE button click.
After that click, button will be still displayed but it will be disabled.
How to make this ?

Dec 28 '06 #1
5 2029
one small thing... when the user clicks submit button ( and if all is ok ),
delete button will be displayed.
Delete button will be hided after you have deleted uploaded file. Then the
submit button should be enabled.

Basicly, you can make one upload, if you uploaded wrong file, you can delete
this one file.
And so on... Delete button will be _displayed_ after submit click, and after
that click, submit button will be _disabled_.

Dec 28 '06 #2
ASM
Joja a écrit :
one small thing... when the user clicks submit button ( and if all is ok ),
delete button will be displayed.
Delete button will be hided after you have deleted uploaded file. Then the
submit button should be enabled.

Basicly, you can make one upload, if you uploaded wrong file, you can delete
this one file.
The form's action usually needs to display a response file.

It is your php with form's action which sends back a page
with a submit button to delete the file just uploaded
no ?

It is not because you did just upload a file, you don't want immediately
upload a new one...

so you need to have your both submit buttons enabled.

The two submit buttons have same name and your php analyzing value of
this variable knows what to do : delete or save.

No need of JavaScript ... ! ! !

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Dec 28 '06 #3
It is not because you did just upload a file, you don't want immediately
upload a new one...
* Correct :-)

so you need to have your both submit buttons enabled.
* The second button is loaded/displayed _after_ you have clicked submit and
if there is a value in the db.
If there is a value in the db, just delete button should be enabled/showed,
without upload button.

So this is why i want to hide upload button after first upload.


Dec 28 '06 #4
ASM
Joja a écrit :
* The second button is loaded/displayed _after_ you have clicked submit and
if there is a value in the db.
If there is a value in the db, just delete button should be enabled/showed,
without upload button.
And how db knows next upload file (not yet chosen) will be uploaded ?
So this is why i want to hide upload button after first upload.
That is your php which have to do that, but you would have not to do it
because on response the file field will be empty and nothing will have
to be send once more (except if you re-display last uploaded file path).

<?
$disbleSend = $disbleDelete = 'disabled';
if($send == 'Send')
{
$disbleDelete = '';
}
else if($send == 'Delete')
{
$disbleSend = '';
}
else
$disbleSend = $disbleDelete = '';
?>

<input type=submit name="send" value="Send" <?= $disbleSend ?/>
<input type=submit name="send" value="Delete" <?= $disbleDelete ?/>
Now,
tell me how I do when button [Send] is disabled to upload a new file ?

This time with a little bit of JS ?

<input type=file
onchange="this.form.elements['send'][0].disabled=false;
this.form.elements['send'][1].disabled=false;" />

(not tested)
You can also use JS to avoid user sends too times same file
(during time file is send user can believes action has failed)

<input type=submit onclick="this.disabled=true" blah />

Don't forget :

<form blah
onsubmit="if(del==1)
return confirm('Are you sure to want to delete this file?');">

<input type=submit name="send" value="Send"
onclick="del=0; this.disabled=true;" <?= $disbleSend ?/>
<input type=submit name="send" value="Delete"
onclick="del=1;" <?= $disbleDelete ?/>
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Dec 28 '06 #5
Joja wrote:
I have form with one submit button.
All i want to create is to allow user to make JUST ONE button click.
After that click, button will be still displayed but it will be disabled.
How to make this ?
You don't. If transmission fails and the user needs to return to the
form, the button may still be disabled and the user will be unable to
resubmit without reloading the form (losing the data entered in the
process).

Filter duplicate submissions server-side. If the process may take a long
time, remind the user of this with a note near the button, but don't
disable button itself.

Mike
Dec 28 '06 #6

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

Similar topics

16
by: Ralph Freshour | last post by:
How can I disable a button once it has been clicked? I want to prevent the user from clicking on it twice if they have a slow connection. Thanks...
2
by: Jeelz | last post by:
Hi Guyz, Would appriciate any tip on disabling an ASP.NET LinkButton using client sided code like javascript. My Requirement is such that the user should be allowed to click on the link...
2
by: Srinivas | last post by:
Hi, I have a webform with some dropdown menus, textboxes required and custom validators. I added a click event handler for the button in which there is code for processing. This processing takes...
1
by: MattB | last post by:
I want to have a "finalize sale" button that disables it's self immediately when pressed (so they can't hit it twice). I thought putting mybutton.enabled=false in the click event would do it, but I...
3
by: Mark | last post by:
This is a solution... Often users want to keep clicking "submit" when they are waiting for server processing. Most apps these days like to disable the submit button to prevent this. You can't just...
2
by: Michael Groeger | last post by:
Hi all, I want to disable a button after it's clicked on the clients side, so that this cannot be clicked twice. I tried this with adding the "onclick" attribute to the button and disable the...
7
by: Vignesh | last post by:
I have tab control which has some TabPages. I want to enable or disable the tabpages based on some condition. It is possible to that. Thanks in advance.
6
by: emmajoh | last post by:
Hi I'm trying to disable IE contextmenu (on a right click) as I want to create my own. The problem is that since I've installed the latest version of the google desktop, the script doesn't...
1
by: mssbass | last post by:
In order to disable the previous and next buttons on my form, I followed the attached code. The buttons seem to work fine except for one thing. When the form first opens, the next button is...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.