Forum Replies Created

Viewing 15 posts - 76 through 90 (of 147 total)
  • Author
    Posts
  • in reply to: Set value if field empty (unanswered) at submit? #26504
    katw
    Participant

    I re-activated “Validate submitted value” on the radio group field AND added your function to change the $validator:

    add_filter('quform_entry_pre_process_1', function (array $result, Quform_Form $form) {
        $propstatus = $form->getElement('quform_1_31');//property status radio group
    
        if ($propstatus) {
            $validator = $propstatus->getValidator('inArray');
    
            if ($validator) {
                $haystack = $validator->config('haystack');
                $haystack[] = 'Query';// <---- NEW VALUE as set in quform_post_set_form_values_1(function)
                $validator->setConfig('haystack', $haystack);
            }
        }
    
        return $result;
    }, 10, 2);

    On submit I get the validation fail, outside range notice "This value is not valid"

    The quform_entry_pre_process_X hook isn’t executed.

    BTW I changed your “InArray” string to “inArray”. May be semantics or may be important ?

    Note I am using the quform_post_set_form_values hook to set the out-of-range option value.

    • This reply was modified 6 years, 9 months ago by katw. Reason: Added debugging info
    • This reply was modified 6 years, 9 months ago by katw. Reason: Added more debugging info for consideration
    in reply to: Set value if field empty (unanswered) at submit? #26503
    katw
    Participant

    Thanks good to know.

    What happens if you are adding multiples? Is the ID treated as a string?

    So you could use “00”, “000” for any extra options you want to create?

    Or would it be better to assert an ID in high number range?

    katw
    Participant

    Oops, too soon.

    Another request … the ability to change the field label for listEntry data column header (so we can shorten for better fit).

    BTW HIDDEN FIELDS cannot have an admin label assigned.

    I know they are ‘hidden’ so their label doesn’t show, so by default the label is ADMIN in nature.

    What I am really saying is the viewing context affects the label descriptor needed.

    In tabular listview I need an abbrev label and in other situations the existing admin or normal label descriptor may suit.

    I don’t suppose we could have hooks like “quform_get_value_label_#_##” added so we can tweak the field label to suit the config:environment?

    • This reply was modified 6 years, 9 months ago by katw. Reason: Corrections
    in reply to: Set value if field empty (unanswered) at submit? #26497
    katw
    Participant

    I have confirmed from testing the post_set_form_values hook is subject to validation.

    So setting a field value outside those options prescribed will result in an error “Not a valid value” on submit.

    So this hook requires one of the values prescribed if “Validate submitted value” is active in field options.

    I will experiment with your suggestions. Thanks Ally

    Question 3:

    What does the parameter 'id' => 0 do in your addOptions() function?

    Does it define position order? Is it a unique id reference?

    I had a quick look at the function reference in Multi.php but couldn’t see how ID was applied there.

    • This reply was modified 6 years, 9 months ago by katw. Reason: Add followup query
    katw
    Participant

    Many thanks.

    Close ticket

    katw
    Participant

    Just so you know…

    An unwanted side-effect of the temporary solution/s is the visibility of the required marker ‘*’ and the tooltip hint text (not tooltip icon) in Edit Entry view.

    Creating a CSS Style to target both and hide them can be used.

    katw
    Participant

    Another request for future updates is the ability to change the field label for listEntry data column header (so we can shorten for better fit).

    And style tweak for the top alignment of data column header field labels; for when labels wrap over multiple lines.

    Thanks

    katw
    Participant

    The hook is running for empty values in viewEntry and frontend.

    Would be great to have it run for listEntry too.

    One for the next update please.

    in reply to: Set value if field empty (unanswered) at submit? #26482
    katw
    Participant

    Question 2.

    I assume QuForm doesn’t validate the value you assign to the field?

    OR

    Does it still honour the “Validate submitted value” setting on the form field advanced settings?

    If YES = still checked THEN {

    Can this new value be added to the option value array?

    So that the change is accepted AND EditEntry mode now shows the expanded set of radio button options for editing the entry?

    }

    If NO = not checked THEN {

    What happens with Edit Entry mode?

    Will a new radio button option be added to the existing set and be selected?

    }

    WHY? I may like to add a new option value to the values defined to make it stand out as a “non answer”.

    katw
    Participant

    Should the options label (which now contains HTML markup) be URL encoded or will this be handled?

    BTW my checkbox label is now 460 characters long.

    So use of a text-editor is a must for tweaking the label content before posting in form builder UI field 😉

    katw
    Participant

    Nice temp fix. But not a long-term one as tooltip text is disconnected from the form builder UI so makes tooltip text maintenance tricky for non-dev users.

    I will give some thought to approaches and share the ideas with you. May be in a few weeks though.

    Thanks for giving it thought.

    in reply to: Set value if field empty (unanswered) at submit? #26479
    katw
    Participant

    Does the

    post_set_form_values

    hook run after the form has successfully passed validation?

    So I can trust the data within the field?

    Thanks

    in reply to: Automatic Serial #26478
    katw
    Participant

    Thanks, that makes the solution super useful.

    in reply to: Custom email notification – other data fields #26451
    katw
    Participant

    That’s neat, thanks.

    Close ticket

    in reply to: Automatic Serial #26402
    katw
    Participant

    Hi Ally,

    Like the suggestion.

    If I understand the code correctly you are creating a new option called ‘quform_serial_number’ and will be incrementing its value after every form post. Correct?

    Just wondering what happens to this on plugin uninstall. From What I understand all options and keys are removed if the plug-in is uninstalled.

    Isn’t this like form data. We want to protect this value when doing a plugin purge/reinstall process?

Viewing 15 posts - 76 through 90 (of 147 total)
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy