javascript buttons updating entry form textedits

1 posts by 1 authors in: Forums > CMS Builder
Last Post: June 25, 2010   (RSS)

By flamerz - June 25, 2010 - edited: June 25, 2010

I did a small trick using the field description.

Maybe this is useful for somebody else.

In the field description i add some javascript to show buttons for update form entry values.

My code is:

<SCRIPT LANGUAGE="JavaScript">
function writeCaja (form) {
form.bank.value = "CAJA RURAL";
form.account.value = "3113-9820-00-xxxxxxxx21"; }
function writeBanco (form) {
form.bank.value = "BANCO DE VALENCIA";
form.account.value = "0093-0511-20-xxxxxx9051"; }
</SCRIPT>
<INPUT TYPE="button" NAME="buttoncr" Value="CAJA RURAL" onClick="writeCaja(this.form)">
<INPUT TYPE="button" NAME="buttonba" Value="BANCO VALENCIA" onClick="writeBanco(this.form)">


I attach some screenshots to show how it looks.

When a button is pressed, it updates the account and bank number values.

I know its not a perfect choice but it works for me.

You can take a look to addbutns.jpg to see another nice shot.. increase/decrease buttons with basic error checks.
Attachments:

ja.jpg 27K

js2.jpg 25K

addbutns.jpg 29K