tenbob
New Member
Could someone please help with this beginner's problem. I've created a form and put a button on it. Clicking the button should take you to different pages according to the data on the form.
I'm not sure how to code the button's javascript in order to access the form data. I found some advice on the forum, but I can't get it to work. For initial testing I just want to display the value in an alert box before I try anything more complex. I got the internal name element name using copy and paste, so it should be right.
Method 1 comes from a forum post here http://fabrikar.com/forums/index.php?wiki/form-javascript-objects/
This just displays '[object Object]'
Method 2 comes from a forum post here http://fabrikar.com/forums/index.php?threads/javascript-to-copy-the-values-into-a-form.12396/
This displays 'undefined'
I'm probably doing something stupid. Can anyone point me in the right direction.
I'm not sure how to code the button's javascript in order to access the form data. I found some advice on the forum, but I can't get it to work. For initial testing I just want to display the value in an alert box before I try anything more complex. I got the internal name element name using copy and paste, so it should be right.
Method 1 comes from a forum post here http://fabrikar.com/forums/index.php?wiki/form-javascript-objects/
JavaScript:
var form = Fabrik.blocks.form_2;
var elements = form.formElements;
var myname = elements.get('fab_stsdir___name');
window.alert(myname);
Method 2 comes from a forum post here http://fabrikar.com/forums/index.php?threads/javascript-to-copy-the-values-into-a-form.12396/
JavaScript:
var myname = $('fab_stsdir___name').getValue();
window.alert(myname);
I'm probably doing something stupid. Can anyone point me in the right direction.