Comments (4)
This is turning out more difficult to address than I thought. Still looking into it.
from algae.
I ended up building a config file with all the form label definitions and custom stuff so i can display them correctly, in the order i want and even use nested boolean select boxes, hidden fields that come up when other field changes value, etc...
my config file looks like:
_MODEL_CONFIG = {
'Perfil': {
'label': u'Perfil',
'items': [
{'label': u'Nombre completo',
'inputs':[
{'key': 'nombre', 'label': u'Nombre', 'validation': ''},
{'key': 'apellidoPaterno', 'label': u'Apellido paterno', 'validation': ''},
{'key': 'apellidoMaterno', 'label': u'Apellido materno', 'validation': ''}
]},
{'key': 'genero', 'label': u'Genero', 'validation': ''},
{'label': u'Fecha de nacimiento',
'inputs':[
{'key': 'diaNacimiento', 'label': u'Día', 'validation': ''},
{'key': 'mesNacimiento', 'label': u'Mes', 'validation': ''},
{'key': 'anoNacimiento', 'label': u'Año', 'validation': ''},
]},
{'key': 'lugarNacimiento', 'label': u'¿En qué estado naciste?', 'validation': ''},
{'key': 'telefono', 'label': u'Teléfono celular', 'validation': {'type':'pattern', 'value': '\+?\d{1,3}?[- .]?\(?(?:\d{2,3})\)?[- .]?\d\d\d[- .]?\d\d\d'}},
{'label': u'Correo electrónico',
'inputs':[
{'key': 'email', 'label': u'email', 'validation': {'type':'pattern', 'value': "/^....$"}},
{'key': 'email2', 'label': u'Confirmar email', 'validation': {'type':'equalTo', 'value': 'email'}},
]}
'DatosBancarios': {
'label': u'Datos bancarios',
'items': [
{'boolean': 'tieneCuentaBancaria',
'label': u'¿Tienes cuenta bancaria?',
'inputs':[
{'label': u'Datos de la cuenta:',
'inputs':[
{'key': 'banco', 'label': u'¿En qué banco está registrada la cuenta?', 'validation': ''}
]},
{'label': u'¿Dónde te depositaremos?',
'inputs':[
{'key': 'clabe' , 'label': u'CLABE', 'validation': ''},
{'key': 'tarjetaDebito' , 'label': u'No. tarjeta de Débito', 'validation': ''},
]},
{'key': 'numeroTarjetas' , 'label': u'¿Cuántas tarjetas de crédito tienes?', 'validation': ''},
]},
{'key': 'tarjetaTiendaDepartamental' , 'label': u'¿Tienes tarjeta de tienda departamental?', 'validation': ''}
]
}
etc
You have to write the model and also its definition in the model file but you get lots of display and formatting stuff in exchange!
from algae.
@pfortes This looks very interesting. Would you like to submit a pull request?
from algae.
That sounds interesting!
i will try to fork your original version and make the basic algae example work with this concept.
i'll let you know as soon as i have something working!
from algae.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from algae.