You are viewing limited content. For full access, please sign in.

Question

Question

Using DIV to place Radio button into HTML Field

asked on August 27, 2015

I have been trying to figure out how to apply THIS code to work with a Radio Button field.  I've found that when I submit the form, the field value does not show and/or is not passed to Laserfiche when stored.  What do I need to do differently with Radio Buttons vs Check Boxes?  Below is the code I'm working with.  

$(document).ready(function () {  
  var FASTrdo = $('#FAST'); //FAST Radio
  var rdoFAST = $('#q141 DIV.cf-field DIV');
  rdoFAST.remove();
  rdoFAST.insertAfter(FASTrdo);
  FASTrdo.remove();
  $('#q141').hide();
});

Thanks,

0 0

Answer

SELECTED ANSWER
replied on August 27, 2015

Use this JavaScript for radio buttons

$(document).ready(function () {  
  var FASTrdo = $('#FAST'); //FAST Radio
  var rdoFAST = $('#q141 DIV.cf-field');
  rdoFAST.remove();
  rdoFAST.insertAfter(FASTrdo);
  FASTrdo.remove();
  $('#q141').hide();
});
2 0

Replies

replied on August 27, 2015

Hi there, is the radio button field you created in cshtml or it's the Forms radio button field? Is the radio button field read only? what you try to achieve with this code?

0 0
replied on August 27, 2015

Abby,

The Radio button field is one created with Forms (#q141) and it is not Read-only, but it IS required. 

Thanks,

Nate

0 0
replied on August 27, 2015 Show version history

What you need this custom javascript for? If you try remove the javascript, can a regular radio button work?

0 0
replied on August 27, 2015

Of course, it CAN work, but it would look a lot nicer if it was embedded in the text.  I figured that if there is a way to do this with a Checkbox, there should be a way to accomplish this with a radio button as well!  Or, I guess another avenue would be to come up with a way to only allow 1 selection for a Checkbox.  

Thanks,

Nate

0 0
SELECTED ANSWER
replied on August 27, 2015

Use this JavaScript for radio buttons

$(document).ready(function () {  
  var FASTrdo = $('#FAST'); //FAST Radio
  var rdoFAST = $('#q141 DIV.cf-field');
  rdoFAST.remove();
  rdoFAST.insertAfter(FASTrdo);
  FASTrdo.remove();
  $('#q141').hide();
});
2 0
replied on August 28, 2020 Show version history

Hey Alex, do you know how to remove the padding/margin after the radio DIV?

 

Edit: Nvm, figured it out.  The DIV is higher up than the radio field set.

0 0
replied on August 28, 2020

PS. When you replace fields like this, the element does not show changes that you can use with Field Rules. 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.