This topic is locked
[SOLVED]

 Reset Button

7/4/2011 5:55:48 PM
PHPRunner General questions
Osteele author

Hello. I would like to place a button at the bottom of my entry form that woulf allow the user to clear all fields that have been filled with a confirm popup message. Possible ?
Thank you!

C
cgphp 7/4/2011

Insert a button in that page.
In the "Client before" section:

ctrl.setEnabled();

if( ! confirm("Do you want to reset the form ?"))

return false;


In the "Server" section:

Leave as a blank page.
In the "Client after" section:

$("input").each(function() {

switch($(this).attr('type')) {

case 'password':

$(this).val('');

break;

case 'text':

$(this).val('');

break;

case 'textarea':

$(this).val('');

break;

case 'checkbox':

$(this).attr('checked', false);

break;

case 'radio':

$(this).attr('checked', false);

}

});
Osteele author 7/5/2011

Thank you very much Christian. I really appreciate your help.
Strange that I am not receiving topic "Reply Notifications"
Guess that I will have to look into that!



Insert a button in that page.
In the "Client before" section:

ctrl.setEnabled();

if( ! confirm("Do you want to reset the form ?"))

return false;


In the "Server" section:

Leave as a blank page.
In the "Client after" section:

$("input").each(function() {

switch($(this).attr('type')) {

case 'password':

$(this).val('');

break;

case 'text':

$(this).val('');

break;

case 'textarea':

$(this).val('');

break;

case 'checkbox':

$(this).attr('checked', false);

break;

case 'radio':

$(this).attr('checked', false);

}

});


Osteele author 7/5/2011

Am I able to copy an adjacent button then modify it. I noticed that the new button does not have the same look as the pre-defined one. eg: border and/or embossed look.
Aside from that, the button works very well. I appreciate it.
Peter



Insert a button in that page.
In the "Client before" section:

ctrl.setEnabled();

if( ! confirm("Do you want to reset the form ?"))

return false;


In the "Server" section:

Leave as a blank page.
In the "Client after" section:

$("input").each(function() {

switch($(this).attr('type')) {

case 'password':

$(this).val('');

break;

case 'text':

$(this).val('');

break;

case 'textarea':

$(this).val('');

break;

case 'checkbox':

$(this).attr('checked', false);

break;

case 'radio':

$(this).attr('checked', false);

}

});