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 <denuwan...@wso2.com> 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]. > > <input class="btn btn-primary add-margin-bottom-3x" type="submit" > name="generatePassword" > id="generatePassword" value="Generate Password"/> > > <input class="btn btn-primary add-margin-bottom-3x" type="submit" > 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