Button Element

How do you make it actioned?

I would like to use this button in some fashion that will record data when depressed and change color after it has been pushed once and if pushed again change back to original state or change the text in the button to "Selected" or some other phrase...

How would this be accomplished?
 
Define "record data".

You can set it to submit the form by just selecting that as the button type. But that's going to act like you hit the Submit button, and do a full form submission, with page reload.

-- hugh
 
Well Hello Hugh!
Thank you for responding to my inquiry once again!
I guess what I am looking for is like a toggle button you turn on and off... and populates field with a Yes when it is toggled on... don't want to record data into database at the moment just set the field to be filled with "Yes" before hitting the submit button for the form
 
Use a 'click' Javascript action on the element, with code like ..

Code:
this.form.formElements.get('yourtable___yourelement').update('blah');
jQuery(this.element).text('new button label');

Replace 'yourtable___yourelement' with the full element name of the element you want to populate. And obviously change the values for the element and the name of the button accordingly.

-- hugh
 
Use a 'click' Javascript action on the element, with code like ..

Code:
this.form.formElements.get('yourtable___yourelement').update('blah');
jQuery(this.element).text('new button label');

Replace 'yourtable___yourelement' with the full element name of the element you want to populate. And obviously change the values for the element and the name of the button accordingly.

-- hugh
I did change to the element name and table name but no value was recorded... The label button changed but the word YES (blah in your example) was not placed into record...
 
Will not record "Yes"
Below are the values used and the java script inserted...
all other fields recorded in form
index.php

index.php

index.php
 
Last edited:
You can't set the cue of the button element itself. Buttons elements don't store values, they are just for triggering actions.

Why not just use a yesno element?
 
I was trying to be fancy! LOL I guess that is what I am left with... unless I can create an action that a button element can trigger to fill in a yesno element!
 
Last edited:
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top