Re: [Dev] [UUF] How to handle multiple form submits within one page

2017-03-10 Thread Denuwanthi De Silva
Hi all,

Thank you for the valuable suggestions.
I too think calling a micro service via ajax would be a better solution.

Thanks


On Fri, Mar 10, 2017 at 10:00 PM, Danushka Fernando 
wrote:

> +1 to use ajax when generate password. When generating a complex pass via
> some tool it will be annoying if browser redirection occurs. I am not too
> sure about security issues that can raise if we do it in front end. But
> ajax is the better option IMHO.
>
> Thanks & Regards
> Danushka Fernando
> Senior Software Engineer
> WSO2 inc. http://wso2.com/
> Mobile : +94716332729 <+94%2071%20633%202729>
>
> On Fri, Mar 10, 2017 at 9:02 PM, Manuranga Perera  wrote:
>
>> 1) Technically it can be done [1] , but i don't think it's very good
>> idea. Generating a password is not really a submit, is it?
>>
> Yes agree.

> I would prefer if you generate password in frontend eg [2] OR write a
>> password generation service and call it using ajax
>>
>> 2) Fragment is just way to organize code, browser has no idea of it.
>> Fragments will help you with code reusability, nothing else.
>>
>> [1] http://stackoverflow.com/questions/547821/two-submit-buttons
>> -in-one-form
>> [2] https://github.com/bermi/password-generator
>>
>> On Fri, Mar 10, 2017 at 2:46 PM, Denuwanthi De Silva > > wrote:
>>
>>> Hi,
>>>
>>> I have a requirement where I have two form submit buttons in my page.
>>> Please refer to "Generate Password" and "Add User" buttons in  the
>>> wireframe [1].
>>>
>>> >> name="generatePassword"
>>>id="generatePassword" value="Generate Password"/>
>>>
>>> >> name="addUser" value="Add User"/>
>>>
>>>
>>>
>>> -When click the "Generate Password" button, a call to onPost() method
>>> will happen.
>>>  Inside that we need to do necessary backend callings to generate the
>>> password.
>>>
>>> -Once the password is generated, and all other text boxes are filled, we
>>> need to click the "Add User" button.
>>> This will also call the same onPost() method.
>>> This time the logic inside onPost will need to do a different set of
>>> logic and calls.
>>>
>>> *So, the same onPost() method will get called twice.*
>>>
>>> 1.What is the way to identify these two buttons seprately in the backend
>>> js onPost() method?
>>>
>>> 2. As an alternative approach, can we use a fragment to hold the
>>> "Generate Password" button and its text box.
>>>Then we can handle button submits related to that button inside the
>>> backend js of that fragment.
>>>
>>>
>>> Do we have any other alternative approach to handle this kind of
>>> scenarios?
>>>
>>>
>>>
>>> [1]https://raw.githubusercontent.com/wso2-dev-ux/product-is/
>>> master/Wireframes/admin-portal/v2/3.1%20Add%20users%20-%20manually.png
>>>
>>> Thanks,
>>> --
>>> Denuwanthi De Silva
>>> Senior Software Engineer;
>>> WSO2 Inc.; http://wso2.com,
>>> Email: denuwan...@wso2.com
>>> Blog: https://denuwanthi.wordpress.com/
>>>
>>
>>
>>
>> --
>> With regards,
>> *Manu*ranga Perera.
>>
>> phone : 071 7 70 20 50
>> mail : m...@wso2.com
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>


-- 
Denuwanthi De Silva
Senior Software Engineer;
WSO2 Inc.; http://wso2.com,
Email: denuwan...@wso2.com
Blog: https://denuwanthi.wordpress.com/
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [UUF] How to handle multiple form submits within one page

2017-03-10 Thread Danushka Fernando
+1 to use ajax when generate password. When generating a complex pass via
some tool it will be annoying if browser redirection occurs. I am not too
sure about security issues that can raise if we do it in front end. But
ajax is the better option IMHO.

Thanks & Regards
Danushka Fernando
Senior Software Engineer
WSO2 inc. http://wso2.com/
Mobile : +94716332729

On Fri, Mar 10, 2017 at 9:02 PM, Manuranga Perera  wrote:

> 1) Technically it can be done [1] , but i don't think it's very good idea.
> Generating a password is not really a submit, is it? I would prefer if you
> generate password in frontend eg [2] OR write a password generation service
> and call it using ajax
>
> 2) Fragment is just way to organize code, browser has no idea of it.
> Fragments will help you with code reusability, nothing else.
>
> [1] http://stackoverflow.com/questions/547821/two-submit-buttons
> -in-one-form
> [2] https://github.com/bermi/password-generator
>
> On Fri, Mar 10, 2017 at 2:46 PM, Denuwanthi De Silva 
> wrote:
>
>> Hi,
>>
>> I have a requirement where I have two form submit buttons in my page.
>> Please refer to "Generate Password" and "Add User" buttons in  the
>> wireframe [1].
>>
>> > name="generatePassword"
>>id="generatePassword" value="Generate Password"/>
>>
>> > name="addUser" value="Add User"/>
>>
>>
>>
>> -When click the "Generate Password" button, a call to onPost() method
>> will happen.
>>  Inside that we need to do necessary backend callings to generate the
>> password.
>>
>> -Once the password is generated, and all other text boxes are filled, we
>> need to click the "Add User" button.
>> This will also call the same onPost() method.
>> This time the logic inside onPost will need to do a different set of
>> logic and calls.
>>
>> *So, the same onPost() method will get called twice.*
>>
>> 1.What is the way to identify these two buttons seprately in the backend
>> js onPost() method?
>>
>> 2. As an alternative approach, can we use a fragment to hold the
>> "Generate Password" button and its text box.
>>Then we can handle button submits related to that button inside the
>> backend js of that fragment.
>>
>>
>> Do we have any other alternative approach to handle this kind of
>> scenarios?
>>
>>
>>
>> [1]https://raw.githubusercontent.com/wso2-dev-ux/product-is/
>> master/Wireframes/admin-portal/v2/3.1%20Add%20users%20-%20manually.png
>>
>> Thanks,
>> --
>> Denuwanthi De Silva
>> Senior Software Engineer;
>> WSO2 Inc.; http://wso2.com,
>> Email: denuwan...@wso2.com
>> Blog: https://denuwanthi.wordpress.com/
>>
>
>
>
> --
> With regards,
> *Manu*ranga Perera.
>
> phone : 071 7 70 20 50
> mail : m...@wso2.com
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [UUF] How to handle multiple form submits within one page

2017-03-10 Thread Manuranga Perera
1) Technically it can be done [1] , but i don't think it's very good idea.
Generating a password is not really a submit, is it? I would prefer if you
generate password in frontend eg [2] OR write a password generation service
and call it using ajax

2) Fragment is just way to organize code, browser has no idea of it.
Fragments will help you with code reusability, nothing else.

[1] http://stackoverflow.com/questions/547821/two-submit-buttons-in-one-form
[2] https://github.com/bermi/password-generator

On Fri, Mar 10, 2017 at 2:46 PM, Denuwanthi De Silva 
wrote:

> Hi,
>
> I have a requirement where I have two form submit buttons in my page.
> Please refer to "Generate Password" and "Add User" buttons in  the
> wireframe [1].
>
>  name="generatePassword"
>id="generatePassword" value="Generate Password"/>
>
>  name="addUser" value="Add User"/>
>
>
>
> -When click the "Generate Password" button, a call to onPost() method will
> happen.
>  Inside that we need to do necessary backend callings to generate the
> password.
>
> -Once the password is generated, and all other text boxes are filled, we
> need to click the "Add User" button.
> This will also call the same onPost() method.
> This time the logic inside onPost will need to do a different set of logic
> and calls.
>
> *So, the same onPost() method will get called twice.*
>
> 1.What is the way to identify these two buttons seprately in the backend
> js onPost() method?
>
> 2. As an alternative approach, can we use a fragment to hold the
> "Generate Password" button and its text box.
>Then we can handle button submits related to that button inside the
> backend js of that fragment.
>
>
> Do we have any other alternative approach to handle this kind of scenarios?
>
>
>
> [1]https://raw.githubusercontent.com/wso2-dev-ux/product-is/
> master/Wireframes/admin-portal/v2/3.1%20Add%20users%20-%20manually.png
>
> Thanks,
> --
> Denuwanthi De Silva
> Senior Software Engineer;
> WSO2 Inc.; http://wso2.com,
> Email: denuwan...@wso2.com
> Blog: https://denuwanthi.wordpress.com/
>



-- 
With regards,
*Manu*ranga Perera.

phone : 071 7 70 20 50
mail : m...@wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev