Mohit Posted October 11, 2023 Share Posted October 11, 2023 Hi Team I am trying to fetch the label of form fields with this api function. $form = $forms->get('shop-payment-stripe'); $fieldDefinitions = $form->fields; If I try to print $fieldDefinitions it shows empty. Also, if I print $form variable it is surely returning ProcessWire\FormBuilderForm Object. Any suggestions how to get the form field labels. (Field names are surely accessible from form) Link to comment Share on other sites More sharing options...
da² Posted October 11, 2023 Share Posted October 11, 2023 Hello, I don't have this class, but I don't see a "fields" property on FormBuilderForm class, nor on its super-classes. But maybe you can do this using "listFields" property and getFieldByName(). Link to comment Share on other sites More sharing options...
BitPoet Posted October 11, 2023 Share Posted October 11, 2023 1 hour ago, Mohit said: Any suggestions how to get the form field labels. $form->children should give you the (structured) fields. If you want the returned list flattened, you can call $form->getChildrenFlat(). Link to comment Share on other sites More sharing options...
Mohit Posted October 12, 2023 Author Share Posted October 12, 2023 Thanks Alot @BitPoet. It surely worked. One more question I have all my form data in an array. I just want to submit my $form and let it do all its functionality that I have assigned in backend with just API. I have saved its entries with $forms->saveEntry( $stripeBillDataArr,$form); The entries saving part is surely working fine but the form is not sending mail as it was configured to send mail to admin from the backend panel. I have tried many different functions as well but nothing is working for me. Any suggestions? Link to comment Share on other sites More sharing options...
BitPoet Posted October 12, 2023 Share Posted October 12, 2023 Not sure if that's easily possible without duplicating a lot of functionality from FormBuilderProcessor. As far as I can see, most methods involved in sending the emails are protected. Maybe the question should be asked in the FormBuilder support forum. Link to comment Share on other sites More sharing options...
Mohit Posted October 12, 2023 Author Share Posted October 12, 2023 ok thanks Mate! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now