Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
¿Es posible preestablecer el tipo de una nueva selección en jQuery FormBuilder?

Uso el agradable FormBuilder de Kevin Chappell

https://formbuilder.online/docs/

Se pueden definir varios tipos para el campo 'texto'. He integrado el nuevo control 'time'. Ahora quiero que si se hace clic en este nuevo control, el 'tiempo' debe estar preestablecido en el campo 'Tipo'.

¿Cómo puedo ajustar eso?

PD: el ejemplo de código no se ejecuta aquí sino solo localmente (tema sessionStorage)

 jQuery(function($) { var fbTemplate = document.getElementById('fb-editor'); var options = { fields : [{ label: 'Time', attrs: { type: 'text' }, icon: '🕑' }], subtypes: { text: ['datetime-local','time'] }, disabledSubtypes: { text: ['password','email','color','tel'], } }; $(fbTemplate).formBuilder(options); });
 body { background: lightgrey; font-family: sans-serif; }
 <!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <title>CodePen - formBuilder: Options -&gt; subtypes</title> <link rel="stylesheet" href="./style.css"> </head> <body> <!-- partial:index.partial.html --> <div id="fb-editor"></div> <!-- partial --> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js'></script> <script src='https://formbuilder.online/assets/js/form-builder.min.js'></script><script src="./script.js"></script> </body> </html>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No lo descubrí, pero tomé un camino diferente para ello. :-)

Ingrese el nuevo elemento como time de tipo en la definición del field . También se ha definido un nuevo subtype time .

Luego agregue el time en el controls register .

 jQuery(function($) { var fbTemplate = document.getElementById('fb-editor'); var options = { fields : [{ label: 'Time', attrs: { type: 'time' }, icon: '🕑' }], subtypes: { time: ['time'] } }; $(fbTemplate).formBuilder(options); }); // src/js/control/text.js // register this control for the following types & text subtypes control.register(['text', 'file', 'date', 'number', 'time'], controlText) control.register(['text', 'password', 'email', 'color', 'tel'], controlText, 'text')
 body { background: lightgrey; font-family: sans-serif; }
 <!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <title>formBuilder</title> <link rel="stylesheet" href="./style.css"> </head> <body> <div id="fb-editor"></div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js'></script> <script src='https://formbuilder.online/assets/js/form-builder.min.js'></script> <script src="./script.js"></script> </body> </html>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!