Create an empty field behaviour

Home Forums Quform WordPress Create an empty field behaviour

This topic is: resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #33878
    TheAlcesh
    Participant

    Hi there,
    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.

    Best regards
    Alcesh

    #33880
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #33913
    TheAlcesh
    Participant

    Worked like a charm.
    Thank you!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy