Customer Portal

Get Involved. Join the Conversation.

Topic

    Shiloh Madsen
    #rn:url_parm:URL Parameter Key#Answered
    Topic posted April 14, 2010 by Shiloh MadsenBronze Trophy: 5,000+ Points, last edited October 29, 2011 
    2488 Views, 9 Comments
    Title:
    #rn:url_parm:URL Parameter Key#
    Content:

    Ok, this is happening on a positvely ancient roll of RNT (Nov 08) so I am not sure how many can help with this issue. I have made a customization to the Input widget to allow it to accept a default value as so:

    <rn:widget path="custom/field/custInput" table="incidents" cf_id="516"  label="Incident Type" def_value="email"/>

    This works fine. The problem comes in when I am trying to make it more dynamic. First I tried just using the #rn:url_parm:inctype in the widget, but that broke things. So, for grins, I tried just outputting it on the page. Surprisingly, it output: #rn:url_parm:inctype instead of test. The url I am testing with is:

    https://motorola-global-es-latam.custhelp.com/app/b2b/ask/inctype/test

    This should work, right? what am I missing?

    I also tried replacing def_value of "email" with "<?=getUrlParm('inctype')?>", but this also failed. Any ideas?

    Best Comment

    Ernie Turner

    You might want to just attach the file next time :)

    The typo I was talking about above wasn't the # sign, you're using

        #rn:url_parm:inctype#

    What you would need to use is

       #rn:url_param:inctype#

    Comment

     

    • Leif Wickland

      Shiloh,

      If you can post your widget's code, I'll try to take a look and figure it out.

      Thanks,

      Leif

    • Ernie Turner

      Unless it's just a typo in the post, the actual tag you want to use is #rn:url_param:inctype# in the widget. However, this will return both the key and value, so it probably won't wok for you.

      What you should probably do is something like this:

          <?$incType = getUrlParm('inctype');?>

           <rn:widget path="custom/field/custInput" .... def_value="#rn:php:$incType#"/>

      As I was basically explaining in this post, you have to use the #rn:php..# tag to insert PHP code into a widget attribute.

    • Shiloh Madsen

      Yeah...sorry...I actually had a typo in the post, i have it as #rn:url_parm:inctype# I forgot the final pound. The other was another option I was trying, which looks like a possibility, but I am curious why this doesn't work. Here is the full code as requested:

      <rn:meta title="Email Us" template="motonav.php" login_required="true" clickstream="incident_create"/><script type="text/javascript"> function RemoveClassName(objElement, strClass) { if ( objElement.className ) { var arrList = objElement.className.split(' '); var strClassUpper = strClass.toUpperCase(); for ( var i = 0; i < arrList.length; i++ ) { if ( arrList[i].toUpperCase() == strClassUpper ) { arrList.splice(i, 1); i--; } } objElement.className = arrList.join(' '); } }</script>
      <style> .noShow, #div_inctype_16{display:none;}</style><!--Section Title--><div id="section_title"> <img src="/euf/assets/images/contact_us_ttl.gif" width="300" alt="Contact Us" /> <!--Login Status--> <rn:widget path="custom/composite/LoginStatus2" /></div> <!--LeftHand Navigations--><rn:widget path="custom/navs/lefthand" />
      <div id="rn_outerwrapper_dbl"> <div id="rn_innerwrapper_dbl"> <!-- Header --> <div id="rn_secondarywrapper" class="rn_answers"> <div id="rn_maincolumn_border"> <div class="rn_list_form"> <rn:widget path="custom/forms/FormOpen" /> <rn:widget path="custom/reports/custommultiline" report_id="138692"/>  <br/> <h2>Email Support</h2> <p>Please complete the email form below to send us an email.</p> <p><span class="rn_required"><em style="color: rgb(255, 0, 0);">*</em>&nbsp;</span>#rn:msg:REQD_FIELD_MSG#</p> <div id="one_column"> Inc Type: #rn:url_parm:inctype# <table> <rn:widget path="custom/field/custInput" table="contacts" field_name="email" required="true" label="#rn:msg:EMAIL_ADDR_LBL#" /> <div ><rn:widget path="custom/field/custInput" table="incidents" cf_id="516"  label="Incident Type" def_value="#rn:url_parm:inctype#"/></div> <rn:widget path="custom/forms/MenuFilterForm" data_type="prod" label="Product" required_lvl="2" /> <!--Todo: Logic to select moto/non moto phone. Also need custom fields for phone brand and phone model when not moto--> <rn:widget path="custom/field/custInput" table="incidents" cf_id="111" label="Carrier" /> <rn:widget path="standard/field/Input" table="incidents" field_name="subject" required="true" label="#rn:msg:SUBJECT_LBL#" initial_focus="true" /> <rn:widget path="standard/field/Input" table="incidents" field_name="thread" required="true" label="#rn:msg:QUESTION_LBL#" /> <tr> <td></td> <td><rn:widget path="standard/utils/FileAttachmentUpload" label="" /></td> </tr> <tr> <td></td> <td><rn:widget path="standard/forms/FormButton" label="#rn:msg:CONTINUE_ELLIPSIS_CMD#" on_success_url="/app/cp/ask_confirm" /></td> </tr> </table> </div> </form> </div> <!-- class="rn_list_form" --> <script type="text/javascript"> var oIMEIdiv = document.getElementById('imeiStuff'); var oProd = document.getElementById('lvl1MenuFilterForm_14'); var oIMEI = document.getElementById('div_incoming_esn_or_csn_16'); var oIMEIfield = document.getElementById('incoming_esn_or_csn_16'); oProd.onchange = function() { if(oProd.value==30) { RemoveClassName(oIMEI, 'noShow'); RemoveClassName(oIMEIdiv, 'noShow'); } else { oIMEIdiv.className = 'noShow'; oIMEI.className = 'noShow'; oIMEI.disabled = true; } } </script> </div> </div> </div></div>

    • Ernie Turner

      You might want to just attach the file next time :)

      The typo I was talking about above wasn't the # sign, you're using

          #rn:url_parm:inctype#

      What you would need to use is

         #rn:url_param:inctype#

    • Leif Wickland

      Shiloh,

      If Ernie's suggestion doesn't work, please attach the original of files you'd like me to take a look at.

      Thanks,

      Leif

    • Shiloh Madsen

      Yup...and I even know why I was confused. Our tag gallery indicates it should be parm, not param. If you fixed that in a later release, cool, but its misspelled there :)

      Also, the behavior is odd. The tag gallery indicates it should ONLY out put the value, but its actually outputting the key and the value, so #rn:url_param:inctype# is outputting inctype/test instead of just test. Is this normal? I can work with it...just curious if I am messing anything up. 

    • Leif Wickland

      Shiloh,

      I'm so sorry about the incorrect documentation wasting your time.  If it's any consolation at all, the version control comment when Ernie fixed that for 9.8 was "Updating horribly incorrect documentation about the url_param tag."

      Leif

    • Shiloh Madsen

      LOL....always great to have some humor when documenting these things *Grin*

      Any idea why im getting a slashed key/value answer for the output instead of just a value?

    • Ernie Turner

      Basically cause that's what the tag actually does (yes I know, it's dumb, I'm sorry). As I kind of mentioned above, I think setting a PHP variable with the getUrlParm() function and then setting that value using the #rn:php..# tag is the way to go here. We've since (November 09) added a new tag named #rn:url_param_value..# which would do what you want, but this workaround should work great in the meantime.

      Sorry about the documentation, I forgot that it was wrong in the tag gallery. :(