OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Edit Registration Form

Are you a Director, Presenter, Reviewer or Conference Manager in need of help? Want to talk to us about workflow issues? This is your forum.

Moderators: jmacgreg, michael

Forum rules
This forum is meant for general questions about the usability of OCS from an everyday user's perspective: conference managers, presenters, and directors are welcome to post questions here, as are librarians and other support staff. We welcome general questions about the role of OCS and how the workflow works, as well as specific function- or user-related questions.

What to do if you have general, workflow or usability questions about OCS:

1. Read the documentation. We've written documentation to cover from OCS basics to system administration and code development, and we encourage you to read it.

2. take a look at the tutorials. We will continue to add tutorials covering OCS basics as time goes on.

3. Post a question. Questions are always welcome here, but if it's a technical question you should probably post to the OCS Technical Support subforum; if you have a development question, try the OCS Development subforum.

Edit Registration Form

Postby paula » Mon Jun 28, 2010 9:47 am

Hi all!

I was wondering if it possible to customize the registration form.
I need to delete and to add new fields for the differents conferences.
I've read that I need to modify the templates of templates/registration/ but the thing is that I need that each registration form (for each conference) being different, ie: I have a conference A with some extra fields in the registration, and a conference B with other fields.

How can I do this?

Thanks for your help!
Paula
paula
 
Posts: 6
Joined: Tue Jun 22, 2010 6:48 am

Re: Edit Registration Form

Postby Bishop » Sun Sep 12, 2010 9:49 pm

I have the same question. Each conference targets a different industry and we would like to ask questions specific to each industry for each conference.

Is this possible without programming?
Bishop
 
Posts: 1
Joined: Sun Sep 12, 2010 9:37 pm

Re: Edit Registration Form

Postby jmacgreg » Mon Sep 13, 2010 9:13 pm

Hi Bishop,

Probably not -- at least, not if you want to extend the *user* registration step. Can you describe in more detail what you're looking for? There may be a way to accommodate your needs otherwise.

Cheers,
James
jmacgreg
 
Posts: 4190
Joined: Tue Feb 14, 2006 10:50 am

Re: Edit Registration Form

Postby ramon » Tue Feb 15, 2011 1:33 pm

Hello all,

We are using the "Special needs" field in the registration form to request registrants to inform their CPF/CNPJ (these are Brazilian local codes for person and institutional identification numbers). We have "customized" the translation and would like to know how to make this field required.
I modified templates/registration/userRegistrationForm.tpl to the following:
Code: Select all
<!--
<p><label for="specialRequests">{translate key="schedConf.registration.specialRequests.description"}</label></p>
-->
<p class="label">{fieldLabel name="specialRequests" key="schedConf.registration.specialRequests.description" required="true}</p>

However, this does not make the field itself mandatory, as it is not validated.
The only post I found with similar information on how to edit fields is quite old...
ramon
 
Posts: 929
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil

Re: Edit Registration Form

Postby jmacgreg » Mon Feb 21, 2011 6:23 pm

Hi Ramon,

This thread might suffice: viewtopic.php?f=8&t=1244. Let me know if that's not the case.

Cheers,
James
jmacgreg
 
Posts: 4190
Joined: Tue Feb 14, 2006 10:50 am

Re: Edit Registration Form [SOLVED]

Postby ramon » Tue Feb 22, 2011 6:53 am

Hello James,

I just don't know where to add the validation code.
We're using OCS 2.3.3.1
Does all the validation occur at classes/user/form/ProfileForm.inc.php?

I added the following to the file above and then to classes/registration/form/RegistrationForm.inc.php
Code: Select all
$this->addCheck(new FormValidator($this, 'specialRequests', 'required', 'manager.registration.form.specialRequests'));


I added the following locale key in locale/[en_US|pt_BR]/manager.xml:[updated]
Code: Select all
<message key="manager.registration.form.specialRequests.required">


I also tried with schedConf.registration.specialRequests, but that didn't work either.

[UPDATE] 2011 - 02 - 22 @ 11:33 AM Brasília standard time (finally DST is over!!!!!!!!!)
I finally understood where I needed to edit the code.
I'm not sure if I must keep the validation in other forms as well though.
This was added to classes/registration/form/UserRegistrationForm.inc.php
Code: Select all
$this->addCheck(new FormValidator($this, 'specialRequests', 'required', 'manager.registration.form.specialRequests'));


Thanks James.
ramon
 
Posts: 929
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil

Re: Edit Registration Form

Postby ramon » Thu Jun 02, 2011 6:57 am

Hello all,

As a follow up on my custom registration form, is it possible to add a verification by matching a word on a specific locale key?
Would this work if using the Custom Translation plugin?

For example, the default for
Code: Select all
<message key="schedConf.registration.specialRequests">Solicitações Especiais</message>

Would be changed to
Code: Select all
<message key="schedConf.registration.specialRequests">CPF/CNPJ e necessidades especiais</message>


Would this suffice?
Code: Select all
if(preg_match($specialCheck,'manager.registration.form.specialRequests')) {
  $this->addCheck(new FormValidator($this, 'specialRequests', 'required', 'manager.registration.form.specialRequests.required'));
}


Is there a better or recommended way to do this?
Since other conferences hosted on the same OCS installation may not require that field to check for registration payments, or maybe in the near future we implement a different approach with a banking billing solution (not credit card payment), I would like the customization to pe as generic and unobtrusive as possible.
ramon
 
Posts: 929
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil

Re: Edit Registration Form

Postby mcrider » Tue Jun 14, 2011 10:58 am

Hi Ramon,

For complex validations like that, we use a FormValidatorCustom validator that allows us to write a custom function to check for a true/false value. See for example this one in classes/author/form/submit/AuthorSubmitStep3Form.inc.php:
Code: Select all
$this->addCheck(new FormValidatorCustom($this, 'authors', 'required', 'author.submit.form.authorRequired', create_function('$authors', 'return count($authors) > 0;')));
There are many other examples of this function throughout the code.

Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: Edit Registration Form

Postby ramon » Tue Jul 03, 2012 1:45 pm

Hello Matt,

I managed to make specialRequests field required in a 2.3.4 OCS with a simple preg_match, looking for special words in the translation key.
However, this isn't working anymore.

How and where do I create that special function to validate?
Is it created on the fly?
ramon
 
Posts: 929
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil

Re: Edit Registration Form

Postby ramon » Wed Jul 04, 2012 6:48 am

Hello anyone,

I'm trying to customize templates/registration/userRegistrationForm.tpl, trying to create a way to change the output of the specialRequests field depending on the content of the translation key schedConf.registration.specialRequests.
The idea is to transform the textarea into an input type="text" when the value of the key has either CPF or CNPJ in it.
The idea is that the template displays the textarea for any conference where the key has not being customized.

I can't figure out a way to use the value of the translation key into a variable.
I can't also figure out how to check for the translation value in classes/registration/form/UserRegistratonForm.tpl

_______________________________
Ramón Martins Sodoma da Fonseca
Analista em C&T
Coordenação de Tecnologias de Informação
Instituto Brasileiro de Informação em Ciência e Tecnologia - IBICT
Ministério da Ciência e Tecnologia - MCT
ramon
 
Posts: 929
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil

Re: Edit Registration Form

Postby ramon » Wed Jul 04, 2012 8:37 am

Hello everyone,

Answering my own question!

In OCS 2.3x, to make the specialRequests field required by testing if the value of the translation key has a certain text in it (in this example, translation key is schedConf.registration.specialRequests, and special words are CPF or CNPJ):
  1. Edit classes/registration/form/UserRegistrationForm.inc.php, near line 47. The following creates an array with the special words and uses PHP's strstr to look for each term. $specialVar is the result of the translate method of PKPLocale class:
    Code: Select all
     
                   /**
                    * Added by Ramón Fonseca
                    * 2012-07-03 @ 15h46 PM
                    * specialRequests field required and validation
                    * Checks if special word is within locale files
                    */
                    $specialCheck = array('CPF', 'CNPJ');
                    $specialVar = PKPLocale::translate('schedConf.registration.specialRequests',$params,$locale);

                    if( strstr($specialVar,$specialCheck[0]) || strstr($specialVar,$specialCheck[1]) ) {
                            $this->addCheck(new FormValidator($this, 'specialRequests', 'required', 'schedConf.registration.specialRequestsRequired'));
                    }

  2. Edit templates/registration/userRegistrationForm.tpl. The following adds a {php} section, near line 257, creating the variables and assigning them to the template. We need {php} to be able to access PKPLocale's translate method directly and create a variable with the translation value, not the key. Then, the if statements outputs different fields for the test result.
    Code: Select all
    {php}
    $specialVar = PKPLocale::translate("schedConf.registration.specialRequests", $params, $locale);
    $cnpj = 'CNPJ';
    $cpf = 'CPF';
    $this->assign('specialVar',$specialVar);
    $this->assign('cpf',$cpf);
    $this->assign('cnpj',$cnpj);
    {/php}
    {if (strstr($specialVar,$cpf) || strstr($specialVar,$cnpj))}
    <p><label for="specialRequests">{translate name="specialRequests" required="true" key="schedConf.registration.specialRequests.description"}</label></p>
    <p><input type="text" name="specialRequests" id="specialRequests" width="60" maxlength="60" class="textField" value="{$specialRequests|escape}" /></p>
    {else}
    <p><label for="specialRequests">{translate name="specialRequests" key="schedConf.registration.specialRequests.description"}</label></p>
    <p><textarea name="specialRequests" id="specialRequests" cols="60" rows="10" class="textArea">{$specialRequests|escape}</textarea></p>
    {/if}

  3. Edit locale/xx_XX/locale.xml (or any locale file of your liking) to add the new message for the required state of specialRequests field
    Code: Select all
    <message key="schedConf.registration.specialRequestsRequired">Campo Solicitações Especiais é obrigatório</message>

  4. Use the Custom Translation Plugin to modify the translations to your needs (in all languages defined as available to the conference!!).
    • schedConf.registration.specialRequests
      • pt_BR Original: Solicitações Especiais
      • pt_BR Custom:CPF / CNPJ
    • schedConf.registration.specialRequests.description
      • pt_BR Original:
        Informe qualquer tipo de necessidade especial, como restrições alimentares, acessibilidade, entre outros.
      • pt_BR Custom:
        Informe o CNPJ da instituição ou CPF para identificação do inscrito conforme exemplos a seguir.<br />
        <strong>CNPJ: XX.XXX.XXX/XXXX-XX</strong><br />
        <strong>CPF: XXX.XXX.XXX-XX</strong>
    • schedConf.registration.specialRequestsRequired
      • pt_BR Original: Campo Solicitações Especiais é obrigatório
      • pt_BR Custom: Campo CPF / CNPJ é obrigatório

If anyone has a cleaner and better solution (like a plugin), that would be awsome!!

[UPDATE - July 04 2012 @ 17h09]
There is a little problem with repeated ID's in the template.
There is a div with id="specialRequests">, which is the same name as the field (either original textarea or custom input type="text").
The label gets confused and probably sets the focus on the div rather than the field (the latter should be the correct one!).

_______________________________
Ramón Martins Sodoma da Fonseca
Analista em C&T
Coordenação de Tecnologias de Informação
Instituto Brasileiro de Informação em Ciência e Tecnologia - IBICT
Ministério da Ciência e Tecnologia - MCT
ramon
 
Posts: 929
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil


Return to OCS Conference Support and Discussion

Who is online

Users browsing this forum: No registered users and 2 guests