[Vtigercrm-developers] Custom views with form fields

Richard Hills richard at tw.co.nz
Thu Jan 23 03:33:06 GMT 2014


And again I have found this. I simply used the existing validationEngine 
call with my own form elements.

> if(jQuery(this).closest(form).validationEngine('validate')) {}

I aim to have this module completed next week and will provide a copy 
online for people to look at, maybe not exactly this module but 
something which gets the idea across in an easy manner.

On 23/01/14 16:23, Richard Hills wrote:
> Another follow up / change of question.
>
> I actually do have validation working on my form, however now the 
> question is how can I check the form has passed validation in my form 
> submit piece? I have altered my form submit to, rather than go 
> straight to edit.php post the data to edit.php via an ajax request and 
> I need to ensure the validation was passed prior to that.
>
> Thanks
>
> On 23/01/14 15:43, Richard Hills wrote:
>> With a bit of work I have now got a custom Edit.js which is almost 
>> working as required. The only thing I believe I am now missing is 
>> validation of the fields prior to submit.
>>
>> Is anyone able to give me some details as to how this can be achieved?
>>
>>
>> On 23/01/14 10:53, Richard Hills wrote:
>>> I have now been able to get the reference fields and date selectors 
>>> both working by creating my modules own resources/Edit.js and adding 
>>> the following code to the registerEvents function:
>>>
>>>>                 var items = jQuery('.recordEditView').length;
>>>>                 for (index = 0; index < items; ++index) {
>>>> this.registerBasicEvents(jQuery('#EditView'+(index+2)));
>>>>                 }
>>>
>>> No doubt this will not help me with additional things such as the 
>>> validation and I am not actually submitting the forms as yet so I 
>>> expect more information to come.
>>>
>>> Ideally we need to look at how the entirety of this script is 
>>> written, there is no reason why this can not work with a class based 
>>> system instead of an id one and going forward this is a must have in 
>>> my opinion. I am not at this point comfortable with attempting the 
>>> entire rewrite before hearing back from the vtiger team, it is 
>>> likely this would be a simple job for whoever wrote the script in 
>>> the first place and knows how it all slots together.
>>>
>>>
>>> On 22/01/14 16:42, Richard Hills wrote:
>>>> Sorry for the spam.
>>>>
>>>> The below solved my issue with date selectors however reference 
>>>> selectors (uitype 10) are still inactive after the change in view 
>>>> name to edit.
>>>>
>>>> On 22/01/14 16:38, Richard Hills wrote:
>>>>> The issue with my input fields not behaving was that my view was 
>>>>> not called edit (and I don't really want it to be as I still 
>>>>> require the normal edit mode).
>>>>>
>>>>> Once I renamed the view to be called "Edit" all worked as expected.
>>>>>
>>>>> Can anyone suggest a solution to this other than me looking 
>>>>> through the code for all references to view = edit and replacing 
>>>>> them with view in (array)?
>>>>>
>>>>> Thanks
>>>>>
>>>>> On 22/01/14 11:02, Richard Hills wrote:
>>>>>> With the following smarty include:
>>>>>> {include file="../Vtiger/uitypes/Reference.tpl"}
>>>>>> And the following PHP:
>>>>>>                 $module = 
>>>>>> Vtiger_Module_Model::getInstance('modulename');
>>>>>>                 $ticketSelect = 
>>>>>> Vtiger_Field_Model::getInstance('ticket',$module);
>>>>>>                 $ticketSelect->set('fieldvalue', 'value');
>>>>>>                 $viewer->assign('FIELD_MODEL', $ticketSelect);
>>>>>>
>>>>>> I was able to put the selector onto my custom view. However I 
>>>>>> have now two issues.
>>>>>>
>>>>>> Firstly I would like to use this more than once on the screen and 
>>>>>> I presume this can not be done without core hacks to adjust id's ?
>>>>>>
>>>>>> And secondly the select currently does nothing (likely some 
>>>>>> additional js is required?).
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> On 22/01/14 10:20, Richard Hills wrote:
>>>>>>> I am attempting to migrate one of our modules to vtiger 6, this 
>>>>>>> module always had an "overlay" screen outside of vtiger where 
>>>>>>> the user could quickly enter data. In this version of the CRM 
>>>>>>> we're looking at integrating this more solidly using a custom view.
>>>>>>>
>>>>>>> I am now at the point where I need to render input fields 
>>>>>>> (uitype 10 among others) for this custom view. Can anyone point 
>>>>>>> me to an example of how this is done?
>>>>>>>
>>>>>>> Thank you
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
richard at tw.co.nz
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061



More information about the vtigercrm-developers mailing list