How to refactor Bootstrap 4 radiobuttons to Bootstrap 5 uinsg Intellij's Structural Replace - intellij-idea

I am trying to update some Java Server Pages/Spring Webflow views from Twitter Bootstrap 4 to Bootstrap 5.
I have lots of radiobuttons and the requisite HTML boilerplate has changed quite a bit from v4 to v5. This seems like a good use-case for IntelliJ's "Structural Replace" but I can't get it to work.
Here is what I am trying:
I just end up with:
I have tried adding filters to the variables ie:
And I have tried changing the "search target" (to label [for example])...
None of these work.
I find Jetbrains' (normally good) doco woeful for this feature.
[edit...example code]
<div class="row mt-2">
<div class="col-4">
<div class="form-check">
<label class="custom-control custom-radio">
<form:radiobutton path="type" value="wdpp" cssClass="custom-control-input"/>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Wires: Pole to Pole</span>
</label>
</div>
<div class="form-check">
<label class="custom-control custom-radio">
<form:radiobutton path="type" value="wdpb" cssClass="custom-control-input"/>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Wires: Pole to Building</span>
</label>
</div>
<div class="form-check">
<label class="custom-control custom-radio">
<form:radiobutton path="type" value="transformer" cssClass="custom-control-input"/>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Transformer</span>
</label>
</div>
<div class="form-check">
<label class="custom-control custom-radio">
<form:radiobutton path="type" value="meterBox" cssClass="custom-control-input"/>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Meter Box</span>
</label>
</div>
<div class="form-check">
<label class="custom-control custom-radio">
<form:radiobutton path="type" value="pole" cssClass="custom-control-input"/>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Pole</span>
</label>
</div>
[...more radios elided...]
</div>
</div>
[edit...a different UI appears sometimes]
Actually, I think that this UI always appears and is then quickly overlayed with the earlier one (the one with the "Find Options..." link)
[wondering about taking this to Jetbrains bug-tracker...]
And the template is:
<replaceConfiguration name="Unnamed" text="<label class="custom-control custom-radio">
<form:radiobutton path="$path$" value="$value$" cssClass="custom-control-input"/>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">$label$</span>
</label>" recursive="false" type="XML" dialect="HTML" search_injected="false" reformatAccordingToStyle="false" shortenFQN="false" replacement="<form:radiobutton id="$path$-$value$" path="$path$" value="$value$" cssClass="form-check-input"/>
<label class="form-check-label" for="$path$-$value$">$label$</label>">
<constraint name="__context__" within="" contains="" />
<constraint name="path" within="" contains="" />
<constraint name="value" within="" contains="" />
<constraint name="label" within="" contains="" />
</replaceConfiguration>
Any thoughts/suggestions/pointers gratefully received.

It appears you are running into a bug, where it is impossible to match JSP tags inside HTML tags. Maybe you can use the following 2-step workaround. First replace the JSP tag with a fake HTML tag:
<replaceConfiguration name="Unnamed" text="<form:radiobutton path="$type$" value="$transformer$" cssClass="custom-control-input"/>" recursive="false" type="Qt UI file" dialect="JSP" reformatAccordingToStyle="false" shortenFQN="false" replacement="<form-radiobutton path="$type$" value="$transformer$" cssClass="custom-control-input"/>">
<constraint name="__context__" within="" contains="" />
<constraint name="type" within="" contains="" />
<constraint name="transformer" within="" contains="" />
</replaceConfiguration>
And then perform an HTML replacement with the new construct:
<replaceConfiguration name="Unnamed" text="<label class="custom-control custom-radio">
<form-radiobutton path="$path$" value="$value$" cssClass="custom-control-input"/>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">$label$</span>
</label>" recursive="false" type="HTML" reformatAccordingToStyle="false" shortenFQN="false" replacement="<form:radiobutton id="$path$-$value$" path="$path$" value="$value$" cssClass="form-check-input"/>
<label class="form-check-label" for="$path$-$value$">$label$</label>">
<constraint name="__context__" within="" contains="" />
<constraint name="path" within="" contains="" />
<constraint name="value" within="" contains="" />
<constraint name="label" within="" contains="" />
</replaceConfiguration>

Related

Radiobutton values are not passing to Controller

In my View I am using following radio buttons
<div class="row">
<div class="col-md-4">
<input name="type" asp-for="loremType" value="1" type="radio" /><label for="rdbLetters">Letters</label>
</div>
<div class="col-md-4">
<input name="type" asp-for="loremType" value="2" type="radio" /><label for="rdbWords">Words</label>
</div>
<div class="col-md-4">
<input name="type" asp-for="loremType" value="3" checked="checked" type="radio" /><label for="rdbParagraphs">Paragraphs</label>
</div>
</div>
loremType is the parameter from the Model Class. Even though the value set as 1,2,3 these values are not passed to the controller.
Am I doing something wrong?

Vuejs checkbox disable if checked

I have 4 checkbox inputs and i want to disable each input if is checked!
And disable all inputs if user checked 2 checkboxes i achive this with v-model length >= 4
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" value="1" v-model="inputs" disabled="inputs.length >= 4">
text1
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" value="2" v-model="inputs" disabled="inputs.length >= 4">
text1
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" value="3" v-model="inputs" disabled="inputs.length >= 4">
text1
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" value="4" v-model="inputs" disabled="inputs.length >= 4">
text1
</label>
</div>
What can i do to disable the input checkbox user checked?
Thanks for your question posting.
I think the disabled property of input tags should be :disabled.
<input type="checkbox" value="1" v-model="inputs" :disabled="inputs.length >= 4" />
Hope for your best result.
Thank you.

looping elements without a wrapper element in vuejs

I have the following code which I would like to generate through a v-for:
<div class="rating-container">
<input type="radio" name="star" value="5" id="star-5">
<label class="star-radio" for="star-5">5</label>
<input type="radio" name="star" value="4" id="star-4">
<label class="star-radio" for="star-4">4</label>
<input type="radio" name="star" value="3" id="star-3">
<label class="star-radio" for="star-3">3</label>
<input type="radio" name="star" value="2" id="star-2">
<label class="star-radio" for="star-2">2</label>
<input type="radio" name="star" value="1" id="star-1">
<label class="star-radio" for="star-1">1</label>
</div>
But I need to keep them in the same order, I mean, a label right after the radio input element, I know v-for on the input tag or the label element would generate all the inputs first and then all the labels
Is there any way to do this with vuejs v-for so that I can preserve the element order and generate them with a loop ?
You could use the template tag as
The template element holds HTML code without displaying it
<div id="app">
<div class="rating-container" >
<template v-for="n in 5">
<input type="radio" name="star" :value="n" :id="'star-'+ n">
<label class="star-radio" :for="'star-'+ n">{{n}}</label>
</template>
</template>
</div>
If you want to loop trough the items in a reversed way you have to do it yourself

How to get widget data in POST method of form submission?

I have widget called List builder, which i used to sort list of contacts.
when i submit the form the, i should get these sorted list of contacts in my $_POST array.
I am getting the content from CGridview widget but not from the following widget:
$this->widget('ext.widgets.multiselects.XMultiSelects',array(
'leftTitle'=>'Email',
'leftName'=>'Contactlist[email][]',
'leftList'=>Contactlist::model()->findUsersByemail( ),
'rightTitle'=>'Email-List',
'rightName'=>'Contactlist[email][]',
//'rightList'=>Contactlist::model()->findUsersByemail( ),
'rightList'=>array(),
'size'=>20,
'width'=>'200px',
));
How to submit this widget data, so that i can access it from $_POST array?
Here is the code generated by this widget:
<form id="yw0" action="/amantran/index.php?r=invmgmt/contactlist/admin" method="get">
<div class="row">
<label for="Contactlist_econtact">Econtact</label> <input size="10" maxlength="10" name="Contactlist[econtact]" id="Contactlist_econtact" type="text" /> </div>
<div class="row">
<label for="Contactlist_fname">Fname</label> <input size="40" maxlength="40" name="Contactlist[fname]" id="Contactlist_fname" type="text" /> </div>
<div class="row">
<label for="Contactlist_lname">Lname</label> <input size="25" maxlength="25" name="Contactlist[lname]" id="Contactlist_lname" type="text" /> </div>
<div class="row">
<label for="Contactlist_email">Email</label> <input size="50" maxlength="50" name="Contactlist[email]" id="Contactlist_email" type="text" /> </div>
<div class="row">
<label for="Contactlist_mobile">Mobile</label> <input size="10" maxlength="10" name="Contactlist[mobile]" id="Contactlist_mobile" type="text" /> </div>
<div class="row">
<label for="Contactlist_address">Address</label> <input size="50" maxlength="50" name="Contactlist[address]" id="Contactlist_address" type="text" /> </div>
<div class="row buttons">
<input type="submit" name="yt0" value="Search" /> </div>
You are having method="get" in your form, change it to method="post"

How to send the http get in Rebol to download an wordpress xml backup file?

I would like to use rebol to download an xml backup of my blog from
http://reboltutorial.com/wp-admin/export.php
the form is
<form action="" method="get">
<h3>Options</h3>
<table class="form-table">
<tr>
<th><label for="author">Restrict Author</label></th>
<td>
<select name="author" id="author">
<option value="all" selected="selected">All Authors</option>
<option value='1'>admin</option></select>
</td>
</tr>
</table>
<p class="submit"><input type="submit" name="submit" class="button" value="Download Export File" />
<input type="hidden" name="download" value="true" />
</p>
</form>
I guess I would first need to log in http://reboltutorial.com/login/ and then what after ?
Any code example to do similar stuff (getting the cookie, ...) ?
<form name="loginform" id="loginform" action="" method="post">
<p>
<label>Username<br />
<input type="text" name="log" id="user_login" class="input" value="" size="20" /></label>
</p>
<p>
<label>Password<br />
<input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /></label>
</p>
<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" /> Remember Me</label></p>
<p class="submit">
<input type="hidden" name="post-from" id="post-from" value="page" />
<input type="hidden" name="action" id="action" value="login" />
<input type="submit" name="wp-submit" id="wp-submit" value="Log In" />
<input type="hidden" name="redirect_to" value="http://reboltutorial.com/wp-admin/" />
<input type="hidden" name="testcookie" value="1" />
</p>
</form>
Try this
http://rebol.wik.is/Protocols/Http