1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice
  2. If you update to Joomla 3.9.16, you will have to update Fabrik from the latest GitHub version, to fix a bug introduced in Joomla, which makes it impossible to list front end folder locations in backend JForms. This affects things like template selection.
    Dismiss Notice

Complex form validations ?

Discussion in 'Standard Support' started by Incremental, Dec 7, 2013.

  1. Incremental

    Incremental Member

    Level: Community
    for a contact Form, I have 2 groups :
    • contact : with public elements for contacting
    • reply : with admin answering elements
    My idea is to have only one form performing different validation actions, when used in public or admin (ACL + templating)
    At the moment, my validation is working for public with a few Forms Plugins :
    • email : send a mail to Admin, when there is a contact,
    • receipt : allows user to receive a copy by mail,
    • redirect : redirect or display a message when Contact is submitted
    Now, I would like to add some actions for admin :
    • store the Reply group element contents in DB,
    • send an email to the user, with the reply.
    1) Storing is always done by the submit button, but I would like to control it.
    Do I just need some PHP run OnBeforeStore ?

    2) Sending an email, I tried to add another email plugin with the condition "Answer message not empty".
    I added the condition :
    return '{contacts___Answer}' != "";
    but it doesn't work ! Any idea ???

    3) I'm wondering if it's not simpler to have only one full PHP plugin performing validations and email sending.
    Are there any limitations in plugins accumulation ?
    For sending emails what is the best PHP code ?

  2. rob

    rob Administrator Staff Member

    Level: Community
    1) I guess so - you'd need to be more specific in what you wanted to do for me to be more sure about my answer though.

    The text area has a default value of 'Ma r?ponse !' - probably why your test is not working?

    There's not specific limitation with plugin accumulation.

    For sending mails you should use the email plugin, if that really isn't what you want then you should use the Joomla mail class to do so - you can see that code in the email plugin
  3. Incremental

    Incremental Member

    Level: Community
    1) Public Form is filled by.... public.
    Contact group elements are filled and Reply group elements are still empty.

    When the admin see a contact message, he should view/modify it,
    and also Reply to it :
    - click on a Reply button or the Reply group makes elements appearing
    - he can fill Reply Group elements for the answer to original contact
    - click on "Save" to :
    • store Reply elements (answer + automatic answer date) and modify Contact status to "replied"
    • then send a mail to the customer with Answer field
    Of course this has to be done only when the Admin filled a Reply (answer date is only filled at this time) and not when the Admin Edit the Contact.
    I'm wondering if a separate PHP "Email answer" button would be simpler (and possible) ?

Share This Page