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

Submit Button

I am trying to right a script so that the "submit button" only appears when
certain criteria has been met. I have tried putting it in an IF statement,
without any luck. Maybe a function would allow me to do this?

<input type="Submit" value="Update">

Any help would be greatly appreciated

TIA

Jim


Jul 17 '05 #1
5 11255
Jimbo wrote:
I am trying to right a script so that the "submit button" only appears when
certain criteria has been met. I have tried putting it in an IF statement,
without any luck. Maybe a function would allow me to do this?

<input type="Submit" value="Update">

Any help would be greatly appreciated


Why didn't the IF work?
What was the error (if it was an error)?

<?php
// ...
if ($ok_to_output_the_submit_button) {
echo '<input type="submit" value="Update"/>';
}
// ...
?>

--
..sig
Jul 17 '05 #2
Jimbo <Ji*@garner21.freeserve.co.uk> wrote:
I am trying to right a script so that the "submit button" only appears when
certain criteria has been met. I have tried putting it in an IF statement,
without any luck. Maybe a function would allow me to do this?
<?php
// this way no button
if(criteria) echo "<input type=\"Submit\" value=\"Update\">";
?>

<?php
// this way grey button
if(criteria) $xtra="disabled";
echo "<input type=\"Submit\" {$xtra} value=\"Update\">";
?>

Any help would be greatly appreciated TIA Jim


There is a disable parameter for I think 'input'
that would grey the button rather than it not
be there. A clear indication in UI terms of
incompletion.
Does that sound like what you want?
Otherwise don't output that part of the form and
it won't appear at all.
(ie the input line you show above as I have mod it)
That's not nice though :)

Hope this helps you.
-Walt

--
Reply to innkeepATcapitalDOTnet to email questions.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 17 '05 #3
On Wed, 12 Nov 2003 21:53:40 -0000, "Jimbo" <Ji*@garner21.freeserve.co.uk>
wrote:
I am trying to right a script so that the "submit button" only appears when
certain criteria has been met. I have tried putting it in an IF statement,
without any luck. Maybe a function would allow me to do this?

<input type="Submit" value="Update">

Any help would be greatly appreciated


Not enough information really; it sounds to me like you're not after a PHP
solution though.

Since the only way to make PHP aware of new information is to at least do a
page request, and probably as a result of submitting a form, then you can't
change any conditions if you don't have a submit button in the first place.

Are you looking for something that can reveal a submit button when certain
fields have all been filled in on the client browser? If so, you need to ask in
a JavaScript group.

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #4
Pedro Graca <he****@hotpop.com> wrote:
Jimbo wrote:
I am trying to right a script so that the "submit button" only appears when
certain criteria has been met. I have tried putting it in an IF statement,
without any luck. Maybe a function would allow me to do this?

<input type="Submit" value="Update">

Any help would be greatly appreciated
Why didn't the IF work?
What was the error (if it was an error)? <?php
// ...
if ($ok_to_output_the_submit_button) {
echo '<input type="submit" value="Update"/>';
}
// ...
?> --
.sig


I get the idea he might not understand the concept
of server side and what echo is doing yet. ie that
you are dynamically emitting the html that client
side will see inside the <?php ... ?>
hopefully these are lightbulbs :)
-Walt

--
Reply to innkeepATcapitalDOTnet to email questions.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 17 '05 #5
Jimbo wrote:
I am trying to right a script so that the "submit button" only appears
when certain criteria has been met. I have tried putting it in an IF
statement, without any luck. Maybe a function would allow me to do this?

<input type="Submit" value="Update">

Any help would be greatly appreciated

TIA

Jim


You definatly want JavaScript here. Even though this is a PHP group, I'll
give you the JS for free

<form name="inputform">
<input type="text" name="field1" value="" onblur="javascript:validate();" />
<input type="text" name="field2" value="" onblur="javascript:validate();" />
<input type="submit" name="submit" value="Submit" disabled
onclick="javascript:disable();" />
</form>
<script language="JavaScript">
function validate(){
if(document.inputform.field1.value != ""){
if(document.inputform.field2.value != ""){
document.inputform.submit.disabled = false;
}
}
}
function disable(){
document.inputform.submit.disabled = true;
document.inputform.submit.value = "Please wait... Form is being
submitted.";
}
</script>
Obviously you will have to edit your form/javascript validation for your
page, but this is the basic idea of what you need to do. With this, it
will be impossible for the user to push the submit button until everything
is validated. It will also disable the submit button after the user clicks
it to prevent double submitting by impatient users.
Jul 17 '05 #6

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

Similar topics

3
by: Matt | last post by:
I want to understand the difference between submit button and regular button: <input type="submit"> and <input type="button">. My understanding is that submit button will send the entire HTML form...
2
by: jb | last post by:
Hello, I need to know which button was pressed in the submit , i tried reading the vaule of submit it the validateDate function but it returns 'undefined' value ; I do this in asp all the time, Not...
15
by: Mattia | last post by:
Hi! I have a <form> that can be submitted thruogh three buttons and I need to tell witch one was pressed when the form was submitted. I now do it with 3 <input type="submit" name="..."...
15
by: M Smith | last post by:
I have a form I want to submit to itself. I want to be able to type in a list of numbers and submit the form and have that list show up on the same form under the text box I typed them into and...
3
by: Adam | last post by:
Hey guys, I've decided to stop banging my head against the wall and just ask you guys for the answer. I can't seem to find it. I have a form in which I have multiple submit buttons; only, I'm...
8
by: bettina | last post by:
I want to submit a form but without a submit button. That's to say, I want that by giving a definite code in a field and then press <ENTER> the form will be submitted. For Example <form...
5
by: rjames.clarke | last post by:
I have the following. $result=mysql_query($sql); $nrows=mysql_num_rows($result); for ($i=0;$i<$nrows;$i++) { $row_array=mysql_fetch_row($result); echo "<form name='testform'...
10
by: ljlolel | last post by:
So.. I have a form that submits to an ASP.net site made in C-sharp. The ASP site is not mine, i do not have the server side code. When I submit from my form by pressing the Submit button, I get...
10
by: The Natural Philosopher | last post by:
I am coding up a bit of javascript stuff, and have managed to stumble my way through most of what I want.. But this one has got me stumped. I call submit() and get a javascript error 'Submit...
4
by: j1dopeman | last post by:
Hi, I'd like to use a button to save and then submit a form. I can set the onlick of the button to mahButton_click or submit, but I can't figure out how to do both. It looks like c# can't...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.