Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating an arbitrary button within a form? #613

Closed
roypardi opened this issue Mar 8, 2018 · 2 comments
Closed

Creating an arbitrary button within a form? #613

roypardi opened this issue Mar 8, 2018 · 2 comments

Comments

@roypardi
Copy link

roypardi commented Mar 8, 2018

(this isn't really an "issue" but I've exhausted all other resources)

I need to be able to add buttons within a form ( for Electron desktop app: buttons to select files, pick directories, etc.). I've dug through all the documentation and searched through all the past issues, where I've seen similar needs posted but no real solutions.

I've tried adding a <button> to a template and ended up with the result in the image below. That is not really a workable solution. I've seen some references in the "issues" about a "button" field type but I have not been able to get that to work.

I've posted project code and details over on stackoverflow but Alpacajs doesn't seem a very active topic there. Does anyone have any suggestions or can give me a gentle shove in the ("a") right direction? I'm no Javascript/HTML hero but I can usually sort things out but this has me stumped.


screen shot 2018-03-07 at 8 39 08 pm

@WhileTrueEndWhile
Copy link

You can find the template for a form element here:
https://github.com/gitana/alpaca/blob/master/src/templates/web-edit/control.html
In your case, the property path is: /path/projectPath
Copy the template from above and paste it into your options as follows:

{
    ...
    "options": {
        "view": {
            "fields": {
                "/path/project/path": {
                    "templates": {
                        "control": `INSERT TEMPLATE HERE`
                    }
                }
            }
        }
    }
    ...
}

Please note the quotation marks.
Now you can insert the button into the template, but you are on your own when it comes to event handling...

@roypardi
Copy link
Author

roypardi commented Mar 9, 2018

Thanks! That helped a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants