Modifying the Form block
Permalink
I am trying to add additional field options to the form block. My new field ("ticketprice") has options (like the textarea and select fields do). When I edit a form and add a textarea or select field, the option fields for those two field types become visible. I can NOT get the edit form to do the same for my new field!
The HTML bit looks like this (truncated):
The auto.js file now looks like this:
Line 62 seems to be the trouble point - I am checking to see if the field type we are adding is of type "ticketprice". So far, I can't get that to work. I tried debugging by setting the type to "text" and it worked... so it feels like the "valid" input types may be defined somewhere else?? Why isn't a new type working? If anyone is familiar with this code, I could use a hand. :(
The HTML bit looks like this (truncated):
<div class="fieldRow"> <div class="fieldLabel"><?php echo t('Answer Type')?>: </div> <div class="fieldValues"> <input name="answerType" type="radio" value="field" /> <?php echo t('Text Field')?> <br> <input name="answerType" type="radio" value="text" /> <?php echo t('Text Area')?> <br> <input name="answerType" type="radio" value="radios" /> <?php echo t('Radio Buttons ')?> <br> <input name="answerType" type="radio" value="select" /> <?php echo t('Select Box')?> <br> <input name="answerType" type="radio" value="checkboxlist" /> <?php echo t('Checkbox List')?> <br> <input name="answerType" type="radio" value="fileupload" /> <?php echo t('File Upload')?> <br> <input name="answerType" type="radio" value="email" /> <?php echo t('Email')?> <br> <!-- non input fields --> <input name="answerType" type="radio" value="plaintext" /> <?php echo t('Plain Text')?> <br> <input name="answerType" type="radio" value="divider" /> <?php echo t('Divider')?> <br> <!-- payment fields --> <input name="answerType" type="radio" value="amount" /> <?php echo t('Custom Amount')?> <br>
Viewing 15 lines of 56 lines. View entire code block.
The auto.js file now looks like this:
var miniSurvey ={ bid:0, serviceURL: $("input[name=miniSurveyServices]").val() + '?block=form&', init: function(){ this.tabSetup(); this.answerTypes=document.forms['ccm-block-form'].answerType; this.answerTypesEdit=document.forms['ccm-block-form'].answerTypeEdit; for(var i=0;i<this.answerTypes.length;i++){ this.answerTypes[i].onclick=function(){miniSurvey.optionsCheck(this);miniSurvey.settingsCheck(this);miniSurvey.ticketPriceCheck(this);} this.answerTypes[i].onchange=function(){miniSurvey.optionsCheck(this);miniSurvey.settingsCheck(this);miniSurvey.ticketPriceCheck(this);} } for(var i=0;i<this.answerTypesEdit.length;i++){ this.answerTypesEdit[i].onclick=function(){miniSurvey.optionsCheck(this,'Edit');miniSurvey.settingsCheck(this,'Edit');miniSurvey.ticketPriceCheck(this,'Edit');} this.answerTypesEdit[i].onchange=function(){miniSurvey.optionsCheck(this,'Edit');miniSurvey.settingsCheck(this,'Edit');miniSurvey.ticketPriceCheck(this,'Edit');} }
Viewing 15 lines of 273 lines. View entire code block.
Line 62 seems to be the trouble point - I am checking to see if the field type we are adding is of type "ticketprice". So far, I can't get that to work. I tried debugging by setting the type to "text" and it worked... so it feels like the "valid" input types may be defined somewhere else?? Why isn't a new type working? If anyone is familiar with this code, I could use a hand. :(
did you ever resolve your problem with this customised form? I am trying to implement something similar, actually simpler since I only need to add options for a divider and header between fields. No luck yet.
cheers
V.