Custom Form Questions


(Squiz) #1

I’m looking at setting up a pretty complex custom form, and one of the requirements is “easy” updating preferably by uploading a CSV file and importing all the values.


Unfortunately the drop-down list is the only thing you can use a CSV file with. I basically need to use checkboxes with multiple elements in the labels, and while I can do it by hand, it’s a lot of work and chance of stuffing things up for an end user that wants to update the form fields themselves.



SO what I was thinking of was making something like an EES extension to upload a CSV file and repopulate the questions based on that. Unfortunately I can’t work out how to set the attributes of a form section correctly and I suspect it’s improbable that the JS API would handle it.



I don’t want to customise the bodycopy because these values are going to change ALL the time, and I don’t want to use an asset listing because I suspect it won’t work particularly well with multi-page forms (basically breaking the back button).



So with that in mind, I’m really not sure how to proceed. I guess I’m just looking for suggestions as to what you’d do. Has anyone got the API to do this?



For reference, I’m trying to do something like the following:







Edit:

Basically I’ve done this with checkboxes and the following in the label field:

    Product Name $123/yr

Description





Just want a way to maintain it, really.

(Anthony Barnes) #2

I think it would be fairly inefficient to script a change to existing custom form questions, not to mention quite complex. What you may be able to do is configure the custom form in a way that you can receive responses generically (Text field values), and use some scripting to generate the form itself and submit to those generic questions. What I mean by this is either:


a.) Generate the form in the dom using javascript that reads your question data in a structured format, or

b.) Generate the form using php and either writing the HTML directly to the form body copy, or copy/paste the generated output.



Both approaches would have their drawbacks, but significantly less time than trying to mess with individual question assets.


(Squiz) #3

Thanks for the thoughts. The original post was probably a bit of a brain fart so I appreciate you taking your time.

[quote]a.) Generate the form in the dom using javascript that reads your question data in a structured format[/quote]



I wonder, is it possible to save the answer to a questions with a %globals_post_variable% keyword? I might be able to asset list a bunch of non-custom-form inputs and save the responses to the form submission with keywords? (I know I said I didn't want to do this but it is the more elegant method).



It still has the problem of breaking the back button, but doesn't require client scripting or a PHP mod. I'll check it out and report back.


(Nic Hubbard) #4

Maybe I am confused here, but how are you saving the form data if you built the form in the dom? Sure, you could easily build the form from an updating list, but how are you then going to easily create corresponding form fields that will then save your data?


(Squiz) #5

I was hoping to use keywords to grab the values that were posted from the form and save them into certain fields in the form submission. Unfortunately this functionality doesn't work this way.


I'm going to end up just filling the labels with arbitrary content, tizzying it up with CSS and maybe some jQuery, then writing a procedure to lay out the required structure. Not ideal for the person who has to update the form, but at least it's usable for the end user.