Representing Pop Up within a Form in collections + json

19 views
Skip to first unread message

Lakshmanan Subbiah

unread,
Feb 15, 2017, 5:49:43 AM2/15/17
to Collection+JSON
Hi 
I am constructing a form which contains a text box on clicking it will open a pop up which blacks the other screen displaying only a pop window consisting of some elements and I have to select one of those and return to form

Eg: consider viewing a photo in facebook the post related to the photo will appear full screen and other parts of the screen is blurred. Just like that in my case, I have to show a list of elements to be selected for a certain field. How to model this using Collections + JSON 

PS: there is a way using it with links but I think that this can be done within a single API call because there is a unsaved form waiting for a single input from the list.
thanks & regards
Lakshmanan

Carles Jove i Buxeda

unread,
Feb 15, 2017, 6:23:51 AM2/15/17
to collect...@googlegroups.com
I believe that templates (form) simply list the attributes that the server needs to create a new resource. In a quick thought, if an attribute's value should be chosen from a list of options, maybe you could add an array key to the element, such as "options", and instruct your client to display options when given? Notice that it shouldn't matter if it gets displayed in a pop-up, a select box, a checklist…

Hope it helps :-)

carles


--
You received this message because you are subscribed to the Google Groups "Collection+JSON" group.
To unsubscribe from this group and stop receiving emails from it, send an email to collectionjson+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Carles Jove i Buxeda

unread,
Feb 15, 2017, 6:25:44 AM2/15/17
to collect...@googlegroups.com
Following up, you can have a look at how other people are extending templates for other use cases, such as validations:

https://github.com/collection-json/extensions/blob/master/template-validation.md

carles

mca

unread,
Feb 17, 2017, 2:24:55 PM2/17/17
to collect...@googlegroups.com
sorry for the slow reply.

I've worked up a "suggest" extension that can be used to present typical HTML SELECT/OPTIONS interfaces or be used to drive a google-style "type-adhead" suggest UI.

Unfortunately, I haven't published the extension spec yet, but here's a quick look at what i am doing.

note in the inline example there are name/value pairs offered as possible inputs and in the related example, there is a pointer to another list within the response to find the name/value pairs.

there is also a plan for the google-style type-ahead but i don't have an implementation yet.

hope this helps.



Lakshmanan Subbiah

unread,
Mar 29, 2017, 9:11:01 AM3/29/17
to Collection+JSON
Hi,
    Sorry for the late reply Mike, I saw the Implementation It was great, but I am afraid this will not be available in my case In my case I wanted to pick a related entity which is completely another resource 

Eg: I will have an application that will contain contacts and companies as separate modules for creating a contact I have to choose a company associated with a contact. So on the fly, I have to choose one of the companies available from my database. This will, in turn, call an API to load a list of companies in the suggest box. In this case should we design something like this ??
{
"name": "company", 
"value": "", 
"prompt": "Company",
"type": "select"
"suggest":"/api/v1/company"
}
Thanks & Regards Lakshmanan




To unsubscribe from this group and stop receiving emails from it, send an email to collectionjso...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Collection+JSON" group.
To unsubscribe from this group and stop receiving emails from it, send an email to collectionjso...@googlegroups.com.

mca

unread,
Mar 29, 2017, 10:56:03 AM3/29/17
to collect...@googlegroups.com
understood.

Here is a comment from the RESTful Web Clients book I provided as a hint:

"There is at least one more mode I didn’t implement that I’d really like to see: web mode. In web mode, the suggest.related value is a valid URL pointing to an API response that returns the list of choices. It could be used to create a simple drop-down or it could be used to implement a key-stroke experience that performs a search on each key press and returns suggested results."

I've updated the gist to show this suggest.related example.  if this is not going to work for you, feel free to build a working example to discuss here.



To unsubscribe from this group and stop receiving emails from it, send an email to collectionjson+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages