Home › Forums › Quform WordPress › Create an empty field behaviour
- This topic has 2 replies, 2 voices, and was last updated 1 year, 2 months ago by TheAlcesh.
- January 12, 2022 at 5:01 pm #33878TheAlceshParticipant
i am trying to create a behaviour for “all” empty fields.
I can’t use a default value for those fields, since our users tend to start typing after the default value – which causes it to always be present in the submitted form and making the content a bit jibberish.
My current idea would be some custom code which iterates over all the text-fields and check if they are empty/null – and if so, changes the content to our default value.
I’m currently stuck with understanding the datastructure(s) provided by QuForm – i don’t intend to ask you for help in developing the code – just some help understanding the right way to go.
Is there a build-in way i can use to create this behaviour?
Is the hook “quform_pre_process” the right one or would you recommend another one?
How do i iterate over all of the Text/Textarea fields in my form, without listing them each by hand?
I was looking for an attribute to iterate over (e.g. for each $field => if $field.type equals text/textarea ==> do something) – but couldn’t find one.
AlceshJanuary 13, 2022 at 11:40 am #33880AllySupport Staff
You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.January 20, 2022 at 8:48 pm #33913TheAlceshParticipant
Worked like a charm.
- You must be logged in to reply to this topic.