this is a general form code
<form name="search_form" action="" method="POST">
<input type="text" name="search_text">
<input type="submit" name="search_bt" value="Go">
</form>
is there a way could have a confirmation dialog saying 'Yes'\'No' or 'Confirm'\'Cancel' etc...
One way i figured of dong is is with CSS Layer and JavaScript and Php... that have a php isset(){}
chechk on the button and when set display a Div displayed with two buttons and onclick=func()
JS function of those buttons have a php variable(flag) set and then i can if(flag){}
to continue or skip some code...
well that is going to work and plus point is that i can have a well themed dialog box but i just wanna make my life easier...
You can also do it with one line in the form tag itself
If you have 2 or more submit buttons in one form:
The dialog shows up only when you click the
Delete
button.is this javascript can be store diferent from tag "form", replace
with something like
Using raw
javascript
without any div...You can have this
function
And you can call that function from the
onsubmit
event in the form, or on theonclick
event in thebutton
.By the way, have you heard about
JQuery
. Its a JS Library with a lot of helpful things that give you a comfort and beauty way of coding javascript.As an example of what you want to get done, take this confirmation dialog from
JQuery
as example